From ecc5dd960c4994998b556409d7d548d582c8c629 Mon Sep 17 00:00:00 2001 From: "houzj.fnst" Date: Mon, 17 Oct 2022 10:57:38 +0800 Subject: [PATCH] Improve errhint for ALTER SUBSCRIPTION ADD/DROP PUBLICATION --- src/backend/commands/subscriptioncmds.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c index 8fb89a9..2fe88a3 100644 --- a/src/backend/commands/subscriptioncmds.c +++ b/src/backend/commands/subscriptioncmds.c @@ -1226,7 +1226,8 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt, ereport(ERROR, (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), errmsg("ALTER SUBSCRIPTION with refresh is not allowed for disabled subscriptions"), - errhint("Use ALTER SUBSCRIPTION ... SET PUBLICATION ... WITH (refresh = false)."))); + errhint("Use ALTER SUBSCRIPTION ... %s PUBLICATION ... WITH (refresh = false).", + isadd ? "ADD" : "DROP"))); /* * See ALTER_SUBSCRIPTION_REFRESH for details why this is @@ -1236,8 +1237,9 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt, ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("ALTER SUBSCRIPTION with refresh and copy_data is not allowed when two_phase is enabled"), - errhint("Use ALTER SUBSCRIPTION ... SET PUBLICATION with refresh = false, or with copy_data = false" - ", or use DROP/CREATE SUBSCRIPTION."))); + errhint("Use ALTER SUBSCRIPTION ... %s PUBLICATION with refresh = false, or with copy_data = false" + ", or use DROP/CREATE SUBSCRIPTION.", + isadd ? "ADD" : "DROP"))); PreventInTransactionBlock(isTopLevel, "ALTER SUBSCRIPTION with refresh"); -- 2.7.2.windows.1