Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit25fb957

Browse files
committed
Improve errhint for ALTER SUBSCRIPTION ADD/DROP PUBLICATION
The original hint says to use SET PUBLICATION when really ADD/DROPPUBLICATION is called for, so this is arguably a bug fix.Also, a very similar message elsewhere was using an inconsistentSQLSTATE.While at it, unwrap some strings.Backpatch to 15.Author: Hou zj <houzj.fnst@fujitsu.com>Discussion:https://postgr.es/m/OS0PR01MB57160AD0E7386547BA978EB394299@OS0PR01MB5716.jpnprd01.prod.outlook.com
1 parentf2f7e50 commit25fb957

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

‎src/backend/commands/subscriptioncmds.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,10 +1135,9 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
11351135
*/
11361136
if (sub->twophasestate==LOGICALREP_TWOPHASE_STATE_ENABLED&&opts.copy_data)
11371137
ereport(ERROR,
1138-
(errcode(ERRCODE_SYNTAX_ERROR),
1138+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
11391139
errmsg("ALTER SUBSCRIPTION with refresh and copy_data is not allowed when two_phase is enabled"),
1140-
errhint("Use ALTER SUBSCRIPTION ...SET PUBLICATION with refresh = false, or with copy_data = false"
1141-
", or use DROP/CREATE SUBSCRIPTION.")));
1140+
errhint("Use ALTER SUBSCRIPTION ... SET PUBLICATION with refresh = false, or with copy_data = false, or use DROP/CREATE SUBSCRIPTION.")));
11421141

11431142
PreventInTransactionBlock(isTopLevel,"ALTER SUBSCRIPTION with refresh");
11441143

@@ -1179,18 +1178,25 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
11791178
ereport(ERROR,
11801179
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
11811180
errmsg("ALTER SUBSCRIPTION with refresh is not allowed for disabled subscriptions"),
1182-
errhint("Use ALTER SUBSCRIPTION ... SET PUBLICATION ... WITH (refresh = false).")));
1181+
/* translator: %s is an SQL ALTER command */
1182+
errhint("Use %s instead.",
1183+
isadd ?
1184+
"ALTER SUBSCRIPTION ... ADD PUBLICATION ... WITH (refresh = false)" :
1185+
"ALTER SUBSCRIPTION ... DROP PUBLICATION ... WITH (refresh = false)")));
11831186

11841187
/*
11851188
* See ALTER_SUBSCRIPTION_REFRESH for details why this is
11861189
* not allowed.
11871190
*/
11881191
if (sub->twophasestate==LOGICALREP_TWOPHASE_STATE_ENABLED&&opts.copy_data)
11891192
ereport(ERROR,
1190-
(errcode(ERRCODE_SYNTAX_ERROR),
1193+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
11911194
errmsg("ALTER SUBSCRIPTION with refresh and copy_data is not allowed when two_phase is enabled"),
1192-
errhint("Use ALTER SUBSCRIPTION ...SET PUBLICATION with refresh = false, or with copy_data = false"
1193-
", or use DROP/CREATE SUBSCRIPTION.")));
1195+
/* translator: %s is an SQL ALTER command */
1196+
errhint("Use %s with refresh = false, or with copy_data = false, or use DROP/CREATE SUBSCRIPTION.",
1197+
isadd ?
1198+
"ALTER SUBSCRIPTION ... ADD PUBLICATION" :
1199+
"ALTER SUBSCRIPTION ... DROP PUBLICATION")));
11941200

11951201
PreventInTransactionBlock(isTopLevel,"ALTER SUBSCRIPTION with refresh");
11961202

@@ -1235,8 +1241,7 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
12351241
ereport(ERROR,
12361242
(errcode(ERRCODE_SYNTAX_ERROR),
12371243
errmsg("ALTER SUBSCRIPTION ... REFRESH with copy_data is not allowed when two_phase is enabled"),
1238-
errhint("Use ALTER SUBSCRIPTION ... REFRESH with copy_data = false"
1239-
", or use DROP/CREATE SUBSCRIPTION.")));
1244+
errhint("Use ALTER SUBSCRIPTION ... REFRESH with copy_data = false, or use DROP/CREATE SUBSCRIPTION.")));
12401245

12411246
PreventInTransactionBlock(isTopLevel,"ALTER SUBSCRIPTION ... REFRESH");
12421247

@@ -1852,8 +1857,8 @@ ReportSlotConnectionError(List *rstates, Oid subid, char *slotname, char *err)
18521857

18531858
ereport(ERROR,
18541859
(errcode(ERRCODE_CONNECTION_FAILURE),
1855-
errmsg("could not connect to publisher when attempting to"
1856-
"drop replication slot \"%s\": %s",slotname,err),
1860+
errmsg("could not connect to publisher when attempting todrop replication slot \"%s\": %s",
1861+
slotname,err),
18571862
/* translator: %s is an SQL ALTER command */
18581863
errhint("Use %s to disassociate the subscription from the slot.",
18591864
"ALTER SUBSCRIPTION ... SET (slot_name = NONE)")));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp