From eb712981a829eb5a1086dbda85df11ff3a5c5dd6 Mon Sep 17 00:00:00 2001 From: zhang_xubo <2578876417@qq.com> Date: Sat, 3 Jun 2023 15:07:05 +0800 Subject: [PATCH] support drop user define extension while enable support_extended_features --- src/gausskernel/optimizer/commands/dropcmds.cpp | 5 ++++- src/test/regress/expected/drop_if_exists.out | 6 +----- src/test/regress/sql/drop_if_exists.sql | 4 +--- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/gausskernel/optimizer/commands/dropcmds.cpp b/src/gausskernel/optimizer/commands/dropcmds.cpp index b331e2f8cc..98ace86364 100644 --- a/src/gausskernel/optimizer/commands/dropcmds.cpp +++ b/src/gausskernel/optimizer/commands/dropcmds.cpp @@ -91,7 +91,10 @@ static void DropExtensionInListIsSupported(List* objname) } } - ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("EXTENSION is not yet supported."))); + /* Enable DROP operation of the above objects during inplace upgrade or support_extended_features is true */ + if (!u_sess->attr.attr_common.IsInplaceUpgrade && !g_instance.attr.attr_common.support_extended_features) { + ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("EXTENSION is not yet supported."))); + } } /* diff --git a/src/test/regress/expected/drop_if_exists.out b/src/test/regress/expected/drop_if_exists.out index 6b3fe60f99..cb3859c5ce 100644 --- a/src/test/regress/expected/drop_if_exists.out +++ b/src/test/regress/expected/drop_if_exists.out @@ -132,11 +132,7 @@ DROP EXTENSION test_extension_exists; ERROR: extension "test_extension_exists" does not exist DROP EXTENSION IF EXISTS test_extension_exists; NOTICE: extension "test_extension_exists" does not exist, skipping --- exists but doesn't support drop -DROP EXTENSION plpgsql; -ERROR: EXTENSION is not yet supported. -DROP EXTENSION IF EXISTS plpgsql; -ERROR: EXTENSION is not yet supported. +\c regression -- functions DROP FUNCTION test_function_exists(); ERROR: function test_function_exists does not exist diff --git a/src/test/regress/sql/drop_if_exists.sql b/src/test/regress/sql/drop_if_exists.sql index 7fee2a4b33..1e68cce6b4 100644 --- a/src/test/regress/sql/drop_if_exists.sql +++ b/src/test/regress/sql/drop_if_exists.sql @@ -145,9 +145,7 @@ DROP TEXT SEARCH CONFIGURATION test_tsconfig_exists; -- doesn't exists DROP EXTENSION test_extension_exists; DROP EXTENSION IF EXISTS test_extension_exists; --- exists but doesn't support drop -DROP EXTENSION plpgsql; -DROP EXTENSION IF EXISTS plpgsql; +\c regression -- functions DROP FUNCTION test_function_exists(); -- Gitee