Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1crGgK-00048i-2K for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Mar 2017 04:18:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1crGgJ-0005wB-LW for pgsql-hackers@arkaria.postgresql.org; Fri, 24 Mar 2017 04:18:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1crGgI-0005w2-Si for pgsql-hackers@postgresql.org; Fri, 24 Mar 2017 04:18:30 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1crGgG-0000mr-Db for pgsql-hackers@postgresql.org; Fri, 24 Mar 2017 04:18:30 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 1109F20B0C for ; Fri, 24 Mar 2017 00:18:27 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute7.internal (MEProxy); Fri, 24 Mar 2017 00:18:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=vcT/EBUsNLQ9kcmBDbxPBE/dKC1g/TwyW/0qyWIOm PY=; b=Ayk6Sox2ahP60JCDw6252VS8kEuKnMvAjIo+hyz5cxSJJ7CLLvj3oWfoG RKldrJu0ZxBD5hNprW4ZYtD/Rp0tW9icpz/iA0LswiNjU4nNMlD0/ZPy7TyMsK6Q byKY6Nu+pSu7rCaG60pg/3tY0CccyF2U4IJql4vTadKN5I5UU1CDhs7lcxCAKE2m HjuXaBmJ3ePN4oTj5mT2hHbpY5ORSxQAhq0vnIHcWHtDf+6LmjtgXFjx7SGgG6J8 CGn2eQ+vhxehb9qhmGmcOfiwkjJfQv+k3VsBuZ/U5w8mquc5pMXFnWe0FsJoGytK ZvHF59uXdkALA9IpW3/AbYU7n9lGA== X-ME-Sender: X-Sasl-enc: +8t4vurRsZFNWGk2cHsdSkkhpF8Dl73lWh+SZ/GjFUnM 1490329106 Received: from april.local (c-73-13-66-39.hsd1.pa.comcast.net [73.13.66.39]) by mail.messagingengine.com (Postfix) with ESMTPA id C1A11242B6 for ; Fri, 24 Mar 2017 00:18:26 -0400 (EDT) To: pgsql-hackers From: Peter Eisentraut Subject: comment/security label for publication/subscription Organization: 2ndQuadrant Message-ID: <5c69fd52-ca00-3dd2-444c-a0b5e673136b@2ndquadrant.com> Date: Fri, 24 Mar 2017 00:18:26 -0400 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------49B9236F6851BBF2B277E696" X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------49B9236F6851BBF2B277E696 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Here is a patch to add COMMENT support for publications and subscriptions. On a similar issue, do we need SECURITY LABEL support for those? Does that make sense? -- Peter Eisentraut http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --------------49B9236F6851BBF2B277E696 Content-Type: invalid/octet-stream; name="0001-Add-COMMENT-support-for-publications-and-subscriptio.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-Add-COMMENT-support-for-publications-and-subscriptio.pa"; filename*1="tch" From e1fbef4e28e2b83c77ef86e0ec05fa548a2c0998 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 24 Mar 2017 00:15:41 -0400 Subject: [PATCH] Add COMMENT support for publications and subscriptions --- doc/src/sgml/ref/comment.sgml | 2 ++ src/backend/parser/gram.y | 16 ++++++++++++++++ src/test/regress/expected/publication.out | 7 +++++++ src/test/regress/expected/subscription.out | 7 +++++++ src/test/regress/sql/publication.sql | 3 +++ src/test/regress/sql/subscription.sql | 4 ++++ 6 files changed, 39 insertions(+) diff --git a/doc/src/sgml/ref/comment.sgml b/doc/src/sgml/ref/comment.sgml index 7483c8c03f..21d8894dc3 100644 --- a/doc/src/sgml/ref/comment.sgml +++ b/doc/src/sgml/ref/comment.sgml @@ -46,11 +46,13 @@ OPERATOR FAMILY object_name USING index_method | POLICY policy_name ON table_name | [ PROCEDURAL ] LANGUAGE object_name | + PUBLICATION object_name | ROLE object_name | RULE rule_name ON table_name | SCHEMA object_name | SEQUENCE object_name | SERVER object_name | + SUBSCRIPTION object_name | TABLE object_name | TABLESPACE object_name | TEXT SEARCH CONFIGURATION object_name | diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 82844a0399..7b812c02ec 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -6225,6 +6225,14 @@ CommentStmt: n->comment = $8; $$ = (Node *) n; } + | COMMENT ON PUBLICATION name IS comment_text + { + CommentStmt *n = makeNode(CommentStmt); + n->objtype = OBJECT_PUBLICATION; + n->object = (Node *) makeString($4); + n->comment = $6; + $$ = (Node *) n; + } | COMMENT ON RULE name ON any_name IS comment_text { CommentStmt *n = makeNode(CommentStmt); @@ -6233,6 +6241,14 @@ CommentStmt: n->comment = $8; $$ = (Node *) n; } + | COMMENT ON SUBSCRIPTION name IS comment_text + { + CommentStmt *n = makeNode(CommentStmt); + n->objtype = OBJECT_SUBSCRIPTION; + n->object = (Node *) makeString($4); + n->comment = $6; + $$ = (Node *) n; + } | COMMENT ON TRANSFORM FOR Typename LANGUAGE name IS comment_text { CommentStmt *n = makeNode(CommentStmt); diff --git a/src/test/regress/expected/publication.out b/src/test/regress/expected/publication.out index 5a7c0edf7d..0964718a60 100644 --- a/src/test/regress/expected/publication.out +++ b/src/test/regress/expected/publication.out @@ -6,6 +6,13 @@ CREATE ROLE regress_publication_user2; CREATE ROLE regress_publication_user_dummy LOGIN NOSUPERUSER; SET SESSION AUTHORIZATION 'regress_publication_user'; CREATE PUBLICATION testpub_default; +COMMENT ON PUBLICATION testpub_default IS 'test publication'; +SELECT obj_description(p.oid, 'pg_publication') FROM pg_publication p; + obj_description +------------------ + test publication +(1 row) + CREATE PUBLICATION testpib_ins_trunct WITH (nopublish delete, nopublish update); ALTER PUBLICATION testpub_default WITH (nopublish insert, nopublish delete); \dRp diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out index 0912bef657..f8d12797e2 100644 --- a/src/test/regress/expected/subscription.out +++ b/src/test/regress/expected/subscription.out @@ -24,6 +24,13 @@ ERROR: invalid connection string syntax: missing "=" after "testconn" in connec CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (NOCONNECT); WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables +COMMENT ON SUBSCRIPTION testsub IS 'test subscription'; +SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s; + obj_description +------------------- + test subscription +(1 row) + \dRs+ List of subscriptions Name | Owner | Enabled | Publication | Conninfo diff --git a/src/test/regress/sql/publication.sql b/src/test/regress/sql/publication.sql index cff9931a77..85530bec0e 100644 --- a/src/test/regress/sql/publication.sql +++ b/src/test/regress/sql/publication.sql @@ -8,6 +8,9 @@ CREATE ROLE regress_publication_user_dummy LOGIN NOSUPERUSER; CREATE PUBLICATION testpub_default; +COMMENT ON PUBLICATION testpub_default IS 'test publication'; +SELECT obj_description(p.oid, 'pg_publication') FROM pg_publication p; + CREATE PUBLICATION testpib_ins_trunct WITH (nopublish delete, nopublish update); ALTER PUBLICATION testpub_default WITH (nopublish insert, nopublish delete); diff --git a/src/test/regress/sql/subscription.sql b/src/test/regress/sql/subscription.sql index c1199ee629..e9d1eab8f8 100644 --- a/src/test/regress/sql/subscription.sql +++ b/src/test/regress/sql/subscription.sql @@ -21,6 +21,10 @@ CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub; CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (NOCONNECT); +COMMENT ON SUBSCRIPTION testsub IS 'test subscription'; +SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s; + + \dRs+ ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 NOREFRESH; -- 2.12.1 --------------49B9236F6851BBF2B277E696 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------49B9236F6851BBF2B277E696--