mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +03:00
Improve the WARNING message for CREATE SUBSCRIPTION.
Author: Peter Smith Reviewed-By: Alvaro Herrera, Tom Lane, Amit Kapila Discussion: https://postgr.es/m/CAHut+PvqdqOanheWSHDyhQiF+Z-7w=-+k4U+bwbT=b6YQ_hrXQ@mail.gmail.com
This commit is contained in:
@ -760,9 +760,8 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
ereport(WARNING,
|
ereport(WARNING,
|
||||||
/* translator: %s is an SQL ALTER statement */
|
(errmsg("subscription was created, but is not connected"),
|
||||||
(errmsg("tables were not subscribed, you will have to run %s to subscribe the tables",
|
errhint("To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.")));
|
||||||
"ALTER SUBSCRIPTION ... REFRESH PUBLICATION")));
|
|
||||||
|
|
||||||
table_close(rel, RowExclusiveLock);
|
table_close(rel, RowExclusiveLock);
|
||||||
|
|
||||||
|
@ -48,7 +48,8 @@ CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
|
|||||||
CREATE PUBLICATION addr_pub_schema FOR TABLES IN SCHEMA addr_nsp;
|
CREATE PUBLICATION addr_pub_schema FOR TABLES IN SCHEMA addr_nsp;
|
||||||
RESET client_min_messages;
|
RESET client_min_messages;
|
||||||
CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
|
CREATE SUBSCRIPTION regress_addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
|
CREATE STATISTICS addr_nsp.gentable_stat ON a, b FROM addr_nsp.gentable;
|
||||||
-- test some error cases
|
-- test some error cases
|
||||||
SELECT pg_get_object_address('stone', '{}', '{}');
|
SELECT pg_get_object_address('stone', '{}', '{}');
|
||||||
|
@ -29,7 +29,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
|
|||||||
ERROR: publication name "foo" used more than once
|
ERROR: publication name "foo" used more than once
|
||||||
-- ok
|
-- ok
|
||||||
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
COMMENT ON SUBSCRIPTION regress_testsub IS 'test subscription';
|
COMMENT ON SUBSCRIPTION regress_testsub IS 'test subscription';
|
||||||
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
|
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
|
||||||
obj_description
|
obj_description
|
||||||
@ -98,7 +99,8 @@ CREATE SUBSCRIPTION regress_testsub2 CONNECTION 'dbname=regress_doesnotexist' PU
|
|||||||
ERROR: subscription with slot_name = NONE must also set enabled = false
|
ERROR: subscription with slot_name = NONE must also set enabled = false
|
||||||
-- ok - with slot_name = NONE
|
-- ok - with slot_name = NONE
|
||||||
CREATE SUBSCRIPTION regress_testsub3 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false);
|
CREATE SUBSCRIPTION regress_testsub3 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
-- fail
|
-- fail
|
||||||
ALTER SUBSCRIPTION regress_testsub3 ENABLE;
|
ALTER SUBSCRIPTION regress_testsub3 ENABLE;
|
||||||
ERROR: cannot enable subscription that does not have a slot name
|
ERROR: cannot enable subscription that does not have a slot name
|
||||||
@ -109,7 +111,8 @@ CREATE SUBSCRIPTION regress_testsub4 CONNECTION 'dbname=regress_doesnotexist' PU
|
|||||||
ERROR: unrecognized origin value: "foo"
|
ERROR: unrecognized origin value: "foo"
|
||||||
-- now it works
|
-- now it works
|
||||||
CREATE SUBSCRIPTION regress_testsub4 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false, origin = none);
|
CREATE SUBSCRIPTION regress_testsub4 CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (slot_name = NONE, connect = false, origin = none);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
\dRs+ regress_testsub4
|
\dRs+ regress_testsub4
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
|
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
|
|||||||
ERROR: binary requires a Boolean value
|
ERROR: binary requires a Boolean value
|
||||||
-- now it works
|
-- now it works
|
||||||
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, binary = true);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, binary = true);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
|
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
|
|||||||
ERROR: streaming requires a Boolean value
|
ERROR: streaming requires a Boolean value
|
||||||
-- now it works
|
-- now it works
|
||||||
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, streaming = true);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, streaming = true);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
|
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
|
|||||||
DROP SUBSCRIPTION regress_testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION mypub
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION mypub
|
||||||
WITH (connect = false, create_slot = false, copy_data = false);
|
WITH (connect = false, create_slot = false, copy_data = false);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
ALTER SUBSCRIPTION regress_testsub ENABLE;
|
ALTER SUBSCRIPTION regress_testsub ENABLE;
|
||||||
-- fail - ALTER SUBSCRIPTION with refresh is not allowed in a transaction
|
-- fail - ALTER SUBSCRIPTION with refresh is not allowed in a transaction
|
||||||
-- block or function
|
-- block or function
|
||||||
@ -338,7 +344,8 @@ CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUB
|
|||||||
ERROR: two_phase requires a Boolean value
|
ERROR: two_phase requires a Boolean value
|
||||||
-- now it works
|
-- now it works
|
||||||
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, two_phase = true);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, two_phase = true);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
|
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);
|
|||||||
DROP SUBSCRIPTION regress_testsub;
|
DROP SUBSCRIPTION regress_testsub;
|
||||||
-- two_phase and streaming are compatible.
|
-- two_phase and streaming are compatible.
|
||||||
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, streaming = true, two_phase = true);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, streaming = true, two_phase = true);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
|
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
|
|||||||
ERROR: disable_on_error requires a Boolean value
|
ERROR: disable_on_error requires a Boolean value
|
||||||
-- now it works
|
-- now it works
|
||||||
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, disable_on_error = false);
|
CREATE SUBSCRIPTION regress_testsub CONNECTION 'dbname=regress_doesnotexist' PUBLICATION testpub WITH (connect = false, disable_on_error = false);
|
||||||
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
|
WARNING: subscription was created, but is not connected
|
||||||
|
HINT: To initiate replication, you must manually create the replication slot, enable the subscription, and refresh the subscription.
|
||||||
\dRs+
|
\dRs+
|
||||||
List of subscriptions
|
List of subscriptions
|
||||||
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
|
Name | Owner | Enabled | Publication | Binary | Streaming | Two-phase commit | Disable on error | Origin | Synchronous commit | Conninfo | Skip LSN
|
||||||
|
Reference in New Issue
Block a user