!903 事务块中禁止删除表空间

Merge pull request !903 from gentle_hu/droptbs
This commit is contained in:
opengauss-bot
2021-05-14 12:12:29 +08:00
committed by Gitee
3 changed files with 13 additions and 4 deletions

View File

@ -2739,14 +2739,14 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi
break;
case T_CreateForeignTableStmt:
#ifdef ENABLE_MULTIPLE_NODES
#ifdef ENABLE_MULTIPLE_NODES
if (!IsInitdb && IS_SINGLE_NODE) {
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("Current mode does not support FOREIGN table yet"),
errdetail("The feature is not currently supported")));
}
#endif
#endif
/* fall through */
case T_CreateStmt: {
#ifdef PGXC
@ -2783,12 +2783,11 @@ void standard_ProcessUtility(Node* parse_tree, const char* query_string, ParamLi
#else
PreventTransactionChain(is_top_level, "CREATE TABLESPACE");
CreateTableSpace((CreateTableSpaceStmt*)parse_tree);
#endif
break;
case T_DropTableSpaceStmt:
#ifdef PGXC
#ifdef ENABLE_MULTIPLE_NODES
if (IS_PGXC_COORDINATOR && !IsConnFromCoord())
PreventTransactionChain(is_top_level, "DROP TABLESPACE");
/* Allow this to be run inside transaction block on remote nodes */

View File

@ -129,5 +129,10 @@ drop tablespace relativeTbs2;
DROP SCHEMA testschema CASCADE;
-- Fail, cannot run inside a transaction block
begin;
drop tablespace testspace;
end;
-- Should succeed
DROP TABLESPACE testspace;

View File

@ -259,5 +259,10 @@ NOTICE: drop cascades to 3 other objects
DETAIL: drop cascades to table testschema.foo
drop cascades to table testschema.asselect
drop cascades to table testschema.atable
-- Fail, cannot run inside a transaction block
begin;
drop tablespace testspace;
ERROR: DROP TABLESPACE cannot run inside a transaction block
end;
-- Should succeed
DROP TABLESPACE testspace;