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

Commit5263c6b

Browse files
author
Amit Kapila
committed
Improve the WARNING message for CREATE SUBSCRIPTION.
Author: Peter SmithReviewed-By: Alvaro Herrera, Tom Lane, Amit KapilaDiscussion:https://postgr.es/m/CAHut+PvqdqOanheWSHDyhQiF+Z-7w=-+k4U+bwbT=b6YQ_hrXQ@mail.gmail.com
1 parent56b6625 commit5263c6b

File tree

3 files changed

+22
-13
lines changed

3 files changed

+22
-13
lines changed

‎src/backend/commands/subscriptioncmds.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,8 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
760760
}
761761
else
762762
ereport(WARNING,
763-
/* translator: %s is an SQL ALTER statement */
764-
(errmsg("tables were not subscribed, you will have to run %s to subscribe the tables",
765-
"ALTER SUBSCRIPTION ... REFRESH PUBLICATION")));
763+
(errmsg("subscription was created, but is not connected"),
764+
errhint("To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.")));
766765

767766
table_close(rel,RowExclusiveLock);
768767

‎src/test/regress/expected/object_address.out

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
4848
CREATE PUBLICATION addr_pub_schema FOR TABLES IN SCHEMA addr_nsp;
4949
RESET client_min_messages;
5050
CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
51-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
51+
WARNING: subscription was created, but is not connected
52+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
5253
CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
5354
-- test some error cases
5455
SELECT pg_get_object_address('stone', '{}', '{}');

‎src/test/regress/expected/subscription.out

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
2929
ERROR: publication name "foo" used more than once
3030
-- ok
3131
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false);
32-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
32+
WARNING: subscription was created, but is not connected
33+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
3334
COMMENT ON SUBSCRIPTION regress_testsub IS 'test subscription';
3435
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
3536
obj_description
@@ -98,7 +99,8 @@ CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PU
9899
ERROR: subscription with slot_name = NONE must also set enabled = false
99100
-- ok - with slot_name = NONE
100101
CREATE SUBSCRIPTION regress_testsub3 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false);
101-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
102+
WARNING: subscription was created, but is not connected
103+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
102104
-- fail
103105
ALTER SUBSCRIPTION regress_testsub3 ENABLE;
104106
ERROR: cannot enable subscription that does not have a slot name
@@ -109,7 +111,8 @@ CREATE SUBSCRIPTION regress_testsub4 CONNECTION 'dbname=regress_doesnotexist' PU
109111
ERROR: unrecognized origin value: "foo"
110112
-- now it works
111113
CREATE SUBSCRIPTION regress_testsub4 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false, origin = none);
112-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
114+
WARNING: subscription was created, but is not connected
115+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
113116
\dRs+ regress_testsub4
114117
List of subscriptions
115118
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
@@ -233,7 +236,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
233236
ERROR: binary requires a Boolean value
234237
-- now it works
235238
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, binary = true);
236-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
239+
WARNING: subscription was created, but is not connected
240+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
237241
\dRs+
238242
List of subscriptions
239243
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
@@ -256,7 +260,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
256260
ERROR: streaming requires a Boolean value
257261
-- now it works
258262
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, streaming = true);
259-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
263+
WARNING: subscription was created, but is not connected
264+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
260265
\dRs+
261266
List of subscriptions
262267
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
@@ -312,7 +317,8 @@ ALTER SUBSCRIPTION regress_testsub DROP PUBLICATION testpub1, testpub2 WITH (ref
312317
DROP SUBSCRIPTION regress_testsub;
313318
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION mypub
314319
WITH (connect = false, create_slot = false, copy_data = false);
315-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
320+
WARNING: subscription was created, but is not connected
321+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
316322
ALTER SUBSCRIPTION regress_testsub ENABLE;
317323
-- fail - ALTER SUBSCRIPTION with refresh is not allowed in a transaction
318324
-- block or function
@@ -338,7 +344,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
338344
ERROR: two_phase requires a Boolean value
339345
-- now it works
340346
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, two_phase = true);
341-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
347+
WARNING: subscription was created, but is not connected
348+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
342349
\dRs+
343350
List of subscriptions
344351
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
@@ -362,7 +369,8 @@ ALTER SUBSCRIPTION regress_testsub SET (slot_name = NONE);
362369
DROP SUBSCRIPTION regress_testsub;
363370
-- two_phase and streaming are compatible.
364371
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, streaming = true, two_phase = true);
365-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
372+
WARNING: subscription was created, but is not connected
373+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
366374
\dRs+
367375
List of subscriptions
368376
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
@@ -377,7 +385,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
377385
ERROR: disable_on_error requires a Boolean value
378386
-- now it works
379387
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, disable_on_error = false);
380-
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
388+
WARNING: subscription was created, but is not connected
389+
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
381390
\dRs+
382391
List of subscriptions
383392
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp