2017-01-19 18:00:00 +01:00
|
|
|
--
|
|
|
|
-- SUBSCRIPTION
|
|
|
|
--
|
|
|
|
|
|
|
|
CREATE ROLE regress_subscription_user LOGIN SUPERUSER;
|
2017-03-08 04:44:59 +01:00
|
|
|
CREATE ROLE regress_subscription_user_dummy LOGIN NOSUPERUSER;
|
2017-01-19 18:00:00 +01:00
|
|
|
SET SESSION AUTHORIZATION 'regress_subscription_user';
|
|
|
|
|
|
|
|
-- fail - no publications
|
|
|
|
CREATE SUBSCRIPTION testsub CONNECTION 'foo';
|
|
|
|
|
|
|
|
-- fail - no connection
|
|
|
|
CREATE SUBSCRIPTION testsub PUBLICATION foo;
|
|
|
|
|
|
|
|
set client_min_messages to error;
|
2017-03-04 05:25:34 +01:00
|
|
|
-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block
|
|
|
|
BEGIN;
|
|
|
|
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub WITH (CREATE SLOT);
|
|
|
|
COMMIT;
|
|
|
|
|
2017-01-19 18:00:00 +01:00
|
|
|
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub;
|
|
|
|
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (DISABLED, NOCREATE SLOT);
|
|
|
|
reset client_min_messages;
|
|
|
|
|
|
|
|
\dRs+
|
|
|
|
|
|
|
|
ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3;
|
|
|
|
|
|
|
|
\dRs
|
|
|
|
|
|
|
|
ALTER SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist2';
|
|
|
|
ALTER SUBSCRIPTION testsub SET PUBLICATION testpub, testpub1;
|
|
|
|
|
|
|
|
\dRs+
|
|
|
|
|
|
|
|
BEGIN;
|
|
|
|
ALTER SUBSCRIPTION testsub ENABLE;
|
|
|
|
|
|
|
|
\dRs
|
|
|
|
|
|
|
|
ALTER SUBSCRIPTION testsub DISABLE;
|
|
|
|
|
|
|
|
\dRs
|
|
|
|
|
|
|
|
COMMIT;
|
|
|
|
|
2017-03-08 04:44:59 +01:00
|
|
|
-- fail - must be owner of subscription
|
|
|
|
SET ROLE regress_subscription_user_dummy;
|
|
|
|
ALTER SUBSCRIPTION testsub RENAME TO testsub_dummy;
|
|
|
|
RESET ROLE;
|
|
|
|
|
2017-03-03 16:47:04 +01:00
|
|
|
ALTER SUBSCRIPTION testsub RENAME TO testsub_foo;
|
|
|
|
|
|
|
|
\dRs
|
|
|
|
|
2017-03-04 05:25:34 +01:00
|
|
|
-- fail - cannot do DROP SUBSCRIPTION DROP SLOT inside transaction block
|
|
|
|
BEGIN;
|
|
|
|
DROP SUBSCRIPTION testsub DROP SLOT;
|
|
|
|
COMMIT;
|
|
|
|
|
|
|
|
BEGIN;
|
2017-03-03 16:47:04 +01:00
|
|
|
DROP SUBSCRIPTION testsub_foo NODROP SLOT;
|
2017-03-04 05:25:34 +01:00
|
|
|
COMMIT;
|
2017-01-19 18:00:00 +01:00
|
|
|
|
|
|
|
RESET SESSION AUTHORIZATION;
|
|
|
|
DROP ROLE regress_subscription_user;
|
2017-03-08 04:44:59 +01:00
|
|
|
DROP ROLE regress_subscription_user_dummy;
|