diff --git a/src/gausskernel/process/tcop/utility.cpp b/src/gausskernel/process/tcop/utility.cpp index 099a5d454..8a08914e3 100644 --- a/src/gausskernel/process/tcop/utility.cpp +++ b/src/gausskernel/process/tcop/utility.cpp @@ -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 */ diff --git a/src/test/regress/input/tablespace.source b/src/test/regress/input/tablespace.source index 53f615723..28e014800 100644 --- a/src/test/regress/input/tablespace.source +++ b/src/test/regress/input/tablespace.source @@ -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; diff --git a/src/test/regress/output/tablespace_1.source b/src/test/regress/output/tablespace_1.source index 2aa46a51f..95b93cca6 100644 --- a/src/test/regress/output/tablespace_1.source +++ b/src/test/regress/output/tablespace_1.source @@ -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;