禁止用户向系统模式添加表
This commit is contained in:
parent
99a9dcbaf8
commit
82f5687df9
|
@ -2866,6 +2866,14 @@ void CheckSetNamespace(Oid oldNspOid, Oid nspOid, Oid classid, Oid objid)
|
|||
|
||||
if (nspOid == PG_CATALOG_NAMESPACE)
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot move objects into system schema")));
|
||||
|
||||
/* disallow set into dbe_perf schema */
|
||||
if (nspOid == PG_DBEPERF_NAMESPACE)
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot move objects into dbe_perf schema")));
|
||||
|
||||
/* disallow set into snapshot schema */
|
||||
if (nspOid == PG_SNAPSHOT_NAMESPACE)
|
||||
ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot move objects into snapshot schema")));
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
-- disable dbe_perf and snapshot
|
||||
---
|
||||
-- 1. Test whether the administrator has dbe_perf and snapshot schema permissions
|
||||
create table t1(col int);
|
||||
alter table t1 set schema dbe_perf;
|
||||
alter table t1 set schema snapshot;
|
||||
-- 2. Test whether the wdr snapshot is generated properly
|
||||
\c postgres
|
||||
alter system set enable_wdr_snapshot to on;
|
||||
\! sleep 15s
|
||||
show enable_wdr_snapshot ;
|
||||
select create_wdr_snapshot();
|
||||
\! sleep 15s
|
||||
select create_wdr_snapshot();
|
||||
\! sleep 15s
|
||||
select create_wdr_snapshot();
|
||||
\! sleep 15s
|
||||
select snapshot_id from snapshot.snapshot limit 4;
|
||||
\! mkdir @abs_srcdir@/temp
|
||||
\a \t \o @abs_srcdir@/temp/wdrTestNode.html
|
||||
\! test -f @abs_srcdir@/temp/wdrTestNode.html && echo "found" || echo "not found"
|
||||
\o \a \t
|
||||
\! rm @abs_srcdir@/temp -rf
|
|
@ -0,0 +1,55 @@
|
|||
---
|
||||
-- disable dbe_perf and snapshot
|
||||
---
|
||||
-- 1. Test whether the administrator has dbe_perf and snapshot schema permissions
|
||||
create table t1(col int);
|
||||
alter table t1 set schema dbe_perf;
|
||||
ERROR: cannot move objects into dbe_perf schema
|
||||
alter table t1 set schema snapshot;
|
||||
ERROR: cannot move objects into snapshot schema
|
||||
-- 2. Test whether the wdr snapshot is generated properly
|
||||
\c postgres
|
||||
alter system set enable_wdr_snapshot to on;
|
||||
\! sleep 15s
|
||||
show enable_wdr_snapshot ;
|
||||
enable_wdr_snapshot
|
||||
---------------------
|
||||
on
|
||||
(1 row)
|
||||
|
||||
select create_wdr_snapshot();
|
||||
create_wdr_snapshot
|
||||
-----------------------------------------
|
||||
WDR snapshot request has been submitted
|
||||
(1 row)
|
||||
|
||||
\! sleep 15s
|
||||
select create_wdr_snapshot();
|
||||
create_wdr_snapshot
|
||||
-----------------------------------------
|
||||
WDR snapshot request has been submitted
|
||||
(1 row)
|
||||
|
||||
\! sleep 15s
|
||||
select create_wdr_snapshot();
|
||||
create_wdr_snapshot
|
||||
-----------------------------------------
|
||||
WDR snapshot request has been submitted
|
||||
(1 row)
|
||||
|
||||
\! sleep 15s
|
||||
select snapshot_id from snapshot.snapshot limit 4;
|
||||
snapshot_id
|
||||
-------------
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
(4 rows)
|
||||
|
||||
\! mkdir /data/archclean/openGauss-server/src/test/regress/temp
|
||||
\a \t \o /data/archclean/openGauss-server/src/test/regress/temp/wdrTestNode.html
|
||||
\! test -f /data/archclean/openGauss-server/src/test/regress/temp/wdrTestNode.html && echo "found" || echo "not found"
|
||||
found
|
||||
\o \a \t
|
||||
\! rm /data/archclean/openGauss-server/src/test/regress/temp -rf
|
|
@ -86,3 +86,4 @@
|
|||
test: alarm_component_test
|
||||
test: unify_definition_superuser
|
||||
test: global_temporary_table_get_table_def
|
||||
test: disable_dbeperf_and_snapshot
|
||||
|
|
Loading…
Reference in New Issue