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;
|
|
|
|
|
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;
|
|
|
|
|
2017-03-23 13:36:36 +01:00
|
|
|
CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (NOCONNECT);
|
2017-01-19 18:00:00 +01:00
|
|
|
|
2017-03-23 13:36:36 +01:00
|
|
|
\dRs+
|
2017-01-19 18:00:00 +01:00
|
|
|
|
2017-03-23 13:36:36 +01:00
|
|
|
ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 NOREFRESH;
|
2017-01-19 18:00:00 +01:00
|
|
|
ALTER SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist2';
|
|
|
|
|
|
|
|
\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-15 21:52:12 +01:00
|
|
|
-- rename back to keep the rest simple
|
|
|
|
ALTER SUBSCRIPTION testsub_foo RENAME TO testsub;
|
|
|
|
|
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-15 21:52:12 +01:00
|
|
|
DROP SUBSCRIPTION testsub 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;
|