禁止用户向内部模式添加表
This commit is contained in:
@ -2700,6 +2700,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_DBMSPERF_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")));
|
||||
}
|
||||
|
||||
/*
|
||||
|
24
src/test/regress/input/disable_dbeperf_and_snapshot.source
Normal file
24
src/test/regress/input/disable_dbeperf_and_snapshot.source
Normal file
@ -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
|
55
src/test/regress/output/disable_dbeperf_and_snapshot.source
Normal file
55
src/test/regress/output/disable_dbeperf_and_snapshot.source
Normal file
@ -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,4 +86,6 @@ test: synchronous_commit_test
|
||||
test: alter_set_same_parameter
|
||||
test: gs_guc_value_range
|
||||
test: global_temporary_table_get_table_def
|
||||
test: double_support_unit
|
||||
test: double_support_unit
|
||||
|
||||
test: disable_dbeperf_and_snapshot
|
Reference in New Issue
Block a user