Commit b8957927 authored by Peter Eisentraut's avatar Peter Eisentraut

Fix segfault in ALTER PUBLICATION/SUBSCRIPTION RENAME

From: Masahiko Sawada <sawada.mshk@gmail.com>
Reported-by: default avatarFujii Masao <masao.fujii@gmail.com>
parent 38305398
...@@ -464,7 +464,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -464,7 +464,7 @@ static const ObjectPropertyType ObjectProperty[] =
InvalidAttrNumber, InvalidAttrNumber,
Anum_pg_publication_pubowner, Anum_pg_publication_pubowner,
InvalidAttrNumber, InvalidAttrNumber,
-1, ACL_KIND_PUBLICATION,
true true
}, },
{ {
...@@ -476,7 +476,7 @@ static const ObjectPropertyType ObjectProperty[] = ...@@ -476,7 +476,7 @@ static const ObjectPropertyType ObjectProperty[] =
InvalidAttrNumber, InvalidAttrNumber,
Anum_pg_subscription_subowner, Anum_pg_subscription_subowner,
InvalidAttrNumber, InvalidAttrNumber,
-1, ACL_KIND_SUBSCRIPTION,
true true
} }
}; };
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
-- PUBLICATION -- PUBLICATION
-- --
CREATE ROLE regress_publication_user LOGIN SUPERUSER; CREATE ROLE regress_publication_user LOGIN SUPERUSER;
CREATE ROLE regress_publication_user_dummy LOGIN NOSUPERUSER;
SET SESSION AUTHORIZATION 'regress_publication_user'; SET SESSION AUTHORIZATION 'regress_publication_user';
CREATE PUBLICATION testpub_default; CREATE PUBLICATION testpub_default;
CREATE PUBLICATION testpib_ins_trunct WITH (nopublish delete, nopublish update); CREATE PUBLICATION testpib_ins_trunct WITH (nopublish delete, nopublish update);
...@@ -148,6 +149,11 @@ DROP TABLE testpub_tbl1; ...@@ -148,6 +149,11 @@ DROP TABLE testpub_tbl1;
t | t | t t | t | t
(1 row) (1 row)
-- faile - must be owner of publication
SET ROLE regress_publication_user_dummy;
ALTER PUBLICATION testpub_default RENAME TO testpub_dummy;
ERROR: must be owner of publication testpub_default
RESET ROLE;
ALTER PUBLICATION testpub_default RENAME TO testpub_foo; ALTER PUBLICATION testpub_default RENAME TO testpub_foo;
\dRp testpub_foo \dRp testpub_foo
List of publications List of publications
...@@ -163,3 +169,4 @@ DROP SCHEMA pub_test CASCADE; ...@@ -163,3 +169,4 @@ DROP SCHEMA pub_test CASCADE;
NOTICE: drop cascades to table pub_test.testpub_nopk NOTICE: drop cascades to table pub_test.testpub_nopk
RESET SESSION AUTHORIZATION; RESET SESSION AUTHORIZATION;
DROP ROLE regress_publication_user; DROP ROLE regress_publication_user;
DROP ROLE regress_publication_user_dummy;
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
-- SUBSCRIPTION -- SUBSCRIPTION
-- --
CREATE ROLE regress_subscription_user LOGIN SUPERUSER; CREATE ROLE regress_subscription_user LOGIN SUPERUSER;
CREATE ROLE regress_subscription_user_dummy LOGIN NOSUPERUSER;
SET SESSION AUTHORIZATION 'regress_subscription_user'; SET SESSION AUTHORIZATION 'regress_subscription_user';
-- fail - no publications -- fail - no publications
CREATE SUBSCRIPTION testsub CONNECTION 'foo'; CREATE SUBSCRIPTION testsub CONNECTION 'foo';
...@@ -66,6 +67,11 @@ ALTER SUBSCRIPTION testsub DISABLE; ...@@ -66,6 +67,11 @@ ALTER SUBSCRIPTION testsub DISABLE;
(1 row) (1 row)
COMMIT; COMMIT;
-- fail - must be owner of subscription
SET ROLE regress_subscription_user_dummy;
ALTER SUBSCRIPTION testsub RENAME TO testsub_dummy;
ERROR: must be owner of subscription testsub
RESET ROLE;
ALTER SUBSCRIPTION testsub RENAME TO testsub_foo; ALTER SUBSCRIPTION testsub RENAME TO testsub_foo;
\dRs \dRs
List of subscriptions List of subscriptions
...@@ -84,3 +90,4 @@ DROP SUBSCRIPTION testsub_foo NODROP SLOT; ...@@ -84,3 +90,4 @@ DROP SUBSCRIPTION testsub_foo NODROP SLOT;
COMMIT; COMMIT;
RESET SESSION AUTHORIZATION; RESET SESSION AUTHORIZATION;
DROP ROLE regress_subscription_user; DROP ROLE regress_subscription_user;
DROP ROLE regress_subscription_user_dummy;
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
-- PUBLICATION -- PUBLICATION
-- --
CREATE ROLE regress_publication_user LOGIN SUPERUSER; CREATE ROLE regress_publication_user LOGIN SUPERUSER;
CREATE ROLE regress_publication_user_dummy LOGIN NOSUPERUSER;
SET SESSION AUTHORIZATION 'regress_publication_user'; SET SESSION AUTHORIZATION 'regress_publication_user';
CREATE PUBLICATION testpub_default; CREATE PUBLICATION testpub_default;
...@@ -73,6 +74,11 @@ DROP TABLE testpub_tbl1; ...@@ -73,6 +74,11 @@ DROP TABLE testpub_tbl1;
\dRp+ testpub_default \dRp+ testpub_default
-- faile - must be owner of publication
SET ROLE regress_publication_user_dummy;
ALTER PUBLICATION testpub_default RENAME TO testpub_dummy;
RESET ROLE;
ALTER PUBLICATION testpub_default RENAME TO testpub_foo; ALTER PUBLICATION testpub_default RENAME TO testpub_foo;
\dRp testpub_foo \dRp testpub_foo
...@@ -85,3 +91,4 @@ DROP SCHEMA pub_test CASCADE; ...@@ -85,3 +91,4 @@ DROP SCHEMA pub_test CASCADE;
RESET SESSION AUTHORIZATION; RESET SESSION AUTHORIZATION;
DROP ROLE regress_publication_user; DROP ROLE regress_publication_user;
DROP ROLE regress_publication_user_dummy;
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
-- --
CREATE ROLE regress_subscription_user LOGIN SUPERUSER; CREATE ROLE regress_subscription_user LOGIN SUPERUSER;
CREATE ROLE regress_subscription_user_dummy LOGIN NOSUPERUSER;
SET SESSION AUTHORIZATION 'regress_subscription_user'; SET SESSION AUTHORIZATION 'regress_subscription_user';
-- fail - no publications -- fail - no publications
...@@ -43,6 +44,11 @@ ALTER SUBSCRIPTION testsub DISABLE; ...@@ -43,6 +44,11 @@ ALTER SUBSCRIPTION testsub DISABLE;
COMMIT; COMMIT;
-- fail - must be owner of subscription
SET ROLE regress_subscription_user_dummy;
ALTER SUBSCRIPTION testsub RENAME TO testsub_dummy;
RESET ROLE;
ALTER SUBSCRIPTION testsub RENAME TO testsub_foo; ALTER SUBSCRIPTION testsub RENAME TO testsub_foo;
\dRs \dRs
...@@ -58,3 +64,4 @@ COMMIT; ...@@ -58,3 +64,4 @@ COMMIT;
RESET SESSION AUTHORIZATION; RESET SESSION AUTHORIZATION;
DROP ROLE regress_subscription_user; DROP ROLE regress_subscription_user;
DROP ROLE regress_subscription_user_dummy;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment