Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
b223c5ef
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b223c5ef
编写于
8月 31, 2016
作者:
A
Andreas Scherbaum
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add Greenplum specific permissions to \du output
Closes: #1050 Closes: #1028
上级
1b02bd8f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
189 addition
and
1 deletion
+189
-1
src/bin/psql/describe.c
src/bin/psql/describe.c
+27
-1
src/test/regress/greenplum_schedule
src/test/regress/greenplum_schedule
+4
-0
src/test/regress/output/psql_gpdb_du.source
src/test/regress/output/psql_gpdb_du.source
+100
-0
src/test/regress/sql/psql_gpdb_du.sql
src/test/regress/sql/psql_gpdb_du.sql
+58
-0
未找到文件。
src/bin/psql/describe.c
浏览文件 @
b223c5ef
...
...
@@ -2862,6 +2862,13 @@ describeRoles(const char *pattern, bool verbose)
" JOIN pg_catalog.pg_roles b ON (m.roleid = b.oid)
\n
"
" WHERE m.member = r.oid) as memberof"
);
/* add Greenplum specific attributes */
appendPQExpBufferStr
(
&
buf
,
"
\n
, r.rolcreaterextgpfd"
);
appendPQExpBufferStr
(
&
buf
,
"
\n
, r.rolcreatewextgpfd"
);
appendPQExpBufferStr
(
&
buf
,
"
\n
, r.rolcreaterexthttp"
);
appendPQExpBufferStr
(
&
buf
,
"
\n
, r.rolcreaterexthdfs"
);
appendPQExpBufferStr
(
&
buf
,
"
\n
, r.rolcreatewexthdfs"
);
if
(
verbose
&&
pset
.
sversion
>=
80200
)
{
appendPQExpBufferStr
(
&
buf
,
"
\n
, pg_catalog.shobj_description(r.oid, 'pg_authid') AS description"
);
...
...
@@ -2923,6 +2930,25 @@ describeRoles(const char *pattern, bool verbose)
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
4
),
"t"
)
==
0
)
add_role_attribute
(
&
buf
,
_
(
"Create DB"
));
/* output Greenplum specific attributes */
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
8
),
"t"
)
==
0
)
add_role_attribute
(
&
buf
,
_
(
"Ext gpfdist Table"
));
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
9
),
"t"
)
==
0
)
add_role_attribute
(
&
buf
,
_
(
"Wri Ext gpfdist Table"
));
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
10
),
"t"
)
==
0
)
add_role_attribute
(
&
buf
,
_
(
"Ext http Table"
));
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
11
),
"t"
)
==
0
)
add_role_attribute
(
&
buf
,
_
(
"Ext hdfs Table"
));
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
12
),
"t"
)
==
0
)
add_role_attribute
(
&
buf
,
_
(
"Wri Ext hdfs Table"
));
/* end Greenplum specific attributes */
if
(
strcmp
(
PQgetvalue
(
res
,
i
,
5
),
"t"
)
!=
0
)
add_role_attribute
(
&
buf
,
_
(
"Cannot login"
));
...
...
@@ -2948,7 +2974,7 @@ describeRoles(const char *pattern, bool verbose)
printTableAddCell
(
&
cont
,
PQgetvalue
(
res
,
i
,
7
),
false
,
false
);
if
(
verbose
&&
pset
.
sversion
>=
80200
)
printTableAddCell
(
&
cont
,
PQgetvalue
(
res
,
i
,
8
),
false
,
false
);
printTableAddCell
(
&
cont
,
PQgetvalue
(
res
,
i
,
8
+
5
/* Greenplum specific attributes */
),
false
,
false
);
}
termPQExpBuffer
(
&
buf
);
...
...
src/test/regress/greenplum_schedule
浏览文件 @
b223c5ef
...
...
@@ -126,4 +126,8 @@ test: uaocs_compaction/threshold
test: uaocs_compaction/index_stats
test: uaocs_compaction/index
test: uaocs_compaction/drop_column
# Test psql \du output
test: psql_gpdb_du
# end of tests
src/test/regress/output/psql_gpdb_du.source
0 → 100644
浏览文件 @
b223c5ef
--
-- Test extended \du flags
--
-- https://github.com/greenplum-db/gpdb/issues/1028
--
-- Problem: the cluster can be initialized with any Unix user
-- therefore create specific test roles here, and only
-- test the \du output for this role, also drop them afterwards
CREATE ROLE test_psql_du_1 WITH SUPERUSER;
\du test_psql_du_1
List of roles
Role name | Attributes | Member of
----------------+-------------------------+-----------
test_psql_du_1 | Superuser, Cannot login | {}
DROP ROLE test_psql_du_1;
CREATE ROLE test_psql_du_2 WITH SUPERUSER CREATEDB CREATEROLE CREATEEXTTABLE LOGIN CONNECTION LIMIT 5;
\du test_psql_du_2
List of roles
Role name | Attributes | Member of
----------------+------------------------------------------------------+-----------
test_psql_du_2 | Superuser, Create role, Create DB, Ext gpfdist Table | {}
: 5 connections
DROP ROLE test_psql_du_2;
-- pg_catalog.pg_roles.rolcreaterextgpfd
CREATE ROLE test_psql_du_e1 WITH SUPERUSER CREATEEXTTABLE (type = 'readable', protocol = 'gpfdist');
\du test_psql_du_e1
List of roles
Role name | Attributes | Member of
-----------------+--------------------------------------------+-----------
test_psql_du_e1 | Superuser, Ext gpfdist Table, Cannot login | {}
DROP ROLE test_psql_du_e1;
CREATE ROLE test_psql_du_e2 WITH SUPERUSER CREATEEXTTABLE (type = 'readable', protocol = 'gpfdists');
\du test_psql_du_e2
List of roles
Role name | Attributes | Member of
-----------------+--------------------------------------------+-----------
test_psql_du_e2 | Superuser, Ext gpfdist Table, Cannot login | {}
DROP ROLE test_psql_du_e2;
-- pg_catalog.pg_roles.rolcreatewextgpfd
CREATE ROLE test_psql_du_e3 WITH SUPERUSER CREATEEXTTABLE (type = 'writable', protocol = 'gpfdist');
\du test_psql_du_e3
List of roles
Role name | Attributes | Member of
-----------------+------------------------------------------------+-----------
test_psql_du_e3 | Superuser, Wri Ext gpfdist Table, Cannot login | {}
DROP ROLE test_psql_du_e3;
CREATE ROLE test_psql_du_e4 WITH SUPERUSER CREATEEXTTABLE (type = 'writable', protocol = 'gpfdists');
\du test_psql_du_e4
List of roles
Role name | Attributes | Member of
-----------------+------------------------------------------------+-----------
test_psql_du_e4 | Superuser, Wri Ext gpfdist Table, Cannot login | {}
DROP ROLE test_psql_du_e4;
-- pg_catalog.pg_roles.rolcreaterexthttp
CREATE ROLE test_psql_du_e5 WITH SUPERUSER CREATEEXTTABLE (type = 'readable', protocol = 'http');
\du test_psql_du_e5
List of roles
Role name | Attributes | Member of
-----------------+-----------------------------------------+-----------
test_psql_du_e5 | Superuser, Ext http Table, Cannot login | {}
DROP ROLE test_psql_du_e5;
-- does dot exist
CREATE ROLE test_psql_du_e6 WITH SUPERUSER CREATEEXTTABLE (type = 'writable', protocol = 'http');
ERROR: invalid CREATEEXTTABLE specification. writable http external tables do not exist
\du test_psql_du_e6
List of roles
Role name | Attributes | Member of
-----------+------------+-----------
DROP ROLE test_psql_du_e6;
ERROR: role "test_psql_du_e6" does not exist
-- pg_catalog.pg_roles.rolcreaterexthdfs
CREATE ROLE test_psql_du_e7 WITH SUPERUSER CREATEEXTTABLE (type = 'readable', protocol = 'gphdfs');
WARNING: GRANT/REVOKE on gphdfs is deprecated
HINT: Issue the GRANT or REVOKE on the protocol itself
\du test_psql_du_e7
List of roles
Role name | Attributes | Member of
-----------------+-----------------------------------------+-----------
test_psql_du_e7 | Superuser, Ext hdfs Table, Cannot login | {}
DROP ROLE test_psql_du_e7;
-- pg_catalog.pg_roles.rolcreatewexthdfs
CREATE ROLE test_psql_du_e8 WITH SUPERUSER CREATEEXTTABLE (type = 'writable', protocol = 'gphdfs');
WARNING: GRANT/REVOKE on gphdfs is deprecated
HINT: Issue the GRANT or REVOKE on the protocol itself
\du test_psql_du_e8
List of roles
Role name | Attributes | Member of
-----------------+---------------------------------------------+-----------
test_psql_du_e8 | Superuser, Wri Ext hdfs Table, Cannot login | {}
DROP ROLE test_psql_du_e8;
src/test/regress/sql/psql_gpdb_du.sql
0 → 100644
浏览文件 @
b223c5ef
--
-- Test extended \du flags
--
-- https://github.com/greenplum-db/gpdb/issues/1028
--
-- Problem: the cluster can be initialized with any Unix user
-- therefore create specific test roles here, and only
-- test the \du output for this role, also drop them afterwards
CREATE
ROLE
test_psql_du_1
WITH
SUPERUSER
;
\
du
test_psql_du_1
DROP
ROLE
test_psql_du_1
;
CREATE
ROLE
test_psql_du_2
WITH
SUPERUSER
CREATEDB
CREATEROLE
CREATEEXTTABLE
LOGIN
CONNECTION
LIMIT
5
;
\
du
test_psql_du_2
DROP
ROLE
test_psql_du_2
;
-- pg_catalog.pg_roles.rolcreaterextgpfd
CREATE
ROLE
test_psql_du_e1
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'readable'
,
protocol
=
'gpfdist'
);
\
du
test_psql_du_e1
DROP
ROLE
test_psql_du_e1
;
CREATE
ROLE
test_psql_du_e2
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'readable'
,
protocol
=
'gpfdists'
);
\
du
test_psql_du_e2
DROP
ROLE
test_psql_du_e2
;
-- pg_catalog.pg_roles.rolcreatewextgpfd
CREATE
ROLE
test_psql_du_e3
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'writable'
,
protocol
=
'gpfdist'
);
\
du
test_psql_du_e3
DROP
ROLE
test_psql_du_e3
;
CREATE
ROLE
test_psql_du_e4
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'writable'
,
protocol
=
'gpfdists'
);
\
du
test_psql_du_e4
DROP
ROLE
test_psql_du_e4
;
-- pg_catalog.pg_roles.rolcreaterexthttp
CREATE
ROLE
test_psql_du_e5
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'readable'
,
protocol
=
'http'
);
\
du
test_psql_du_e5
DROP
ROLE
test_psql_du_e5
;
-- does dot exist
CREATE
ROLE
test_psql_du_e6
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'writable'
,
protocol
=
'http'
);
\
du
test_psql_du_e6
DROP
ROLE
test_psql_du_e6
;
-- pg_catalog.pg_roles.rolcreaterexthdfs
CREATE
ROLE
test_psql_du_e7
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'readable'
,
protocol
=
'gphdfs'
);
\
du
test_psql_du_e7
DROP
ROLE
test_psql_du_e7
;
-- pg_catalog.pg_roles.rolcreatewexthdfs
CREATE
ROLE
test_psql_du_e8
WITH
SUPERUSER
CREATEEXTTABLE
(
type
=
'writable'
,
protocol
=
'gphdfs'
);
\
du
test_psql_du_e8
DROP
ROLE
test_psql_du_e8
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录