diff --git a/src/common/backend/catalog/namespace.cpp b/src/common/backend/catalog/namespace.cpp index e9108c460..6e3c72497 100755 --- a/src/common/backend/catalog/namespace.cpp +++ b/src/common/backend/catalog/namespace.cpp @@ -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"))); } /* diff --git a/src/test/regress/input/disable_dbeperf_and_snapshot.source b/src/test/regress/input/disable_dbeperf_and_snapshot.source new file mode 100644 index 000000000..f7e1608fc --- /dev/null +++ b/src/test/regress/input/disable_dbeperf_and_snapshot.source @@ -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 \ No newline at end of file diff --git a/src/test/regress/output/disable_dbeperf_and_snapshot.source b/src/test/regress/output/disable_dbeperf_and_snapshot.source new file mode 100644 index 000000000..0a5f1ec19 --- /dev/null +++ b/src/test/regress/output/disable_dbeperf_and_snapshot.source @@ -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 \ No newline at end of file diff --git a/src/test/regress/parallel_schedule10 b/src/test/regress/parallel_schedule10 index a0e6d788a..9e5eef9e8 100644 --- a/src/test/regress/parallel_schedule10 +++ b/src/test/regress/parallel_schedule10 @@ -86,3 +86,4 @@ test: alarm_component_test test: unify_definition_superuser test: global_temporary_table_get_table_def + test: disable_dbeperf_and_snapshot