Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxXN3-0006Nx-Ig for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Dec 2021 16:43:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mxXN1-0001PN-O7 for pgsql-hackers@arkaria.postgresql.org; Wed, 15 Dec 2021 16:43:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxXN0-0001PE-Il for pgsql-hackers@lists.postgresql.org; Wed, 15 Dec 2021 16:43:11 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mxXMt-00034o-JF for pgsql-hackers@lists.postgresql.org; Wed, 15 Dec 2021 16:43:09 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 013393200C4A; Wed, 15 Dec 2021 11:43:00 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 15 Dec 2021 11:43:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=qstcp8gAbyfjKxOtB6702p/Qela7pNuJtMOu1aa88Wc=; b=hU8Dy85e uMwmM8FsDnThAnAd0i3Sc0We7owwZ21fRWXf8wQeTW86Hv51q/NFaJEhRZzca5ls yPLM7HzQN6rZOHclZqpTNh4oWb+yPfKp3G9CEu5545OiYFpYFI2XTrX4igljh6Fu y7km4i3LrfLXAnlwbTST2whnGX5kPYYtqcYN5yZR37DrfwuDj6Kv+ioeml4StueH Ek4sEFT3MCaNUY287M05GkvJpKpB0lxrZtXUMYWqbZ5rj3omqKeIGwpz+oUiBCRh KAl6LU/NDL8/I8hb1HyGeWl+X5gdyRUjcB5x6WQSh8SX4u/A0/8vFPeVz2sON8Zc tbzZ8IxWnf3Z+A== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvuddrledvgdelfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgrrhho ucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgheqne cuggftrfgrthhtvghrnhepudejveejffejveduudetvdekieeuiedtvdeileefkeevjedu feeguedvjefhueelnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomhenuc evlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgv rhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 15 Dec 2021 11:42:59 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 004672A079D; Wed, 15 Dec 2021 13:42:55 -0300 (-03) Date: Wed, 15 Dec 2021 13:42:55 -0300 From: Alvaro Herrera To: Tomas Vondra Cc: Peter Eisentraut , PostgreSQL Hackers , Petr Jelinek Subject: Re: logical decoding and replication of sequences Message-ID: <202112151642.h7cehn6zplxg@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Looking at 0003, On 2021-Dec-14, Tomas Vondra wrote: > diff --git a/doc/src/sgml/ref/alter_publication.sgml b/doc/src/sgml/ref/alter_publication.sgml > index bb4ef5e5e22..4d166ad3f9c 100644 > --- a/doc/src/sgml/ref/alter_publication.sgml > +++ b/doc/src/sgml/ref/alter_publication.sgml > @@ -31,7 +31,9 @@ ALTER PUBLICATION name RENAME TO where publication_object is one of: > > TABLE [ ONLY ] table_name [ * ] [, ... ] > + SEQUENCE sequence_name [ * ] [, ... ] > ALL TABLES IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ] > + ALL SEQUENCE IN SCHEMA { schema_name | CURRENT_SCHEMA } [, ... ] Note that this says ALL SEQUENCE; I think it should be ALL SEQUENCES. > diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y > index 3d4dd43e47b..f037c17985b 100644 > --- a/src/backend/parser/gram.y > +++ b/src/backend/parser/gram.y > @@ -9762,6 +9762,26 @@ PublicationObjSpec: ... > + | ALL SEQUENCE IN_P SCHEMA ColId > + { > + $$ = makeNode(PublicationObjSpec); > + $$->pubobjtype = PUBLICATIONOBJ_SEQUENCE_IN_SCHEMA; > + $$->name = $5; > + $$->location = @5; > + } > + | ALL SEQUENCES IN_P SCHEMA CURRENT_SCHEMA > + { > + $$ = makeNode(PublicationObjSpec); > + $$->pubobjtype = PUBLICATIONOBJ_SEQUENCE_IN_CUR_SCHEMA; > + $$->location = @5; > + } And here you have ALL SEQUENCE in one spot and ALL SEQUENCES in the other. BTW I think these enum values should use the plural too, PUBLICATIONOBJ_SEQUENCES_IN_CUR_SCHEMA (not SEQUENCE). I suppose you copied from PUBLICATIONOBJ_TABLE_IN_CUR_SCHEMA, but that too seems to be a mistake: should be PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA. > @@ -10097,6 +10117,12 @@ UnlistenStmt: > } > ; > > +/* > + * FIXME > + * > + * opt_publication_for_sequences and publication_for_sequences should be > + * copies for sequences > + */ Not sure if this FIXME is relevant or should just be removed. > @@ -10105,6 +10131,12 @@ UnlistenStmt: > * BEGIN / COMMIT / ROLLBACK > * (also older versions END / ABORT) > * > + * ALTER PUBLICATION name ADD SEQUENCE sequence [, sequence2] > + * > + * ALTER PUBLICATION name DROP SEQUENCE sequence [, sequence2] > + * > + * ALTER PUBLICATION name SET SEQUENCE sequence [, sequence2] > + * This comment addition seems misplaced? > diff --git a/src/bin/psql/tab-complete.c b/src/bin/psql/tab-complete.c > index 2f412ca3db3..e30bf7b1b55 100644 > --- a/src/bin/psql/tab-complete.c > +++ b/src/bin/psql/tab-complete.c > @@ -1647,13 +1647,13 @@ psql_completion(const char *text, int start, int end) > COMPLETE_WITH("ADD", "DROP", "OWNER TO", "RENAME TO", "SET"); > /* ALTER PUBLICATION ADD */ > else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD")) > - COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE"); > + COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE|SEQUENCE"); > /* ALTER PUBLICATION DROP */ > else if (Matches("ALTER", "PUBLICATION", MatchAny, "DROP")) > - COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE"); > + COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE|SEQUENCE"); > /* ALTER PUBLICATION SET */ > else if (Matches("ALTER", "PUBLICATION", MatchAny, "SET")) > - COMPLETE_WITH("(", "ALL TABLES IN SCHEMA", "TABLE"); > + COMPLETE_WITH("(", "ALL TABLES IN SCHEMA", "TABLE|SEQUENCE"); I think you should also add "ALL SEQUENCES IN SCHEMA" to these lists. > else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD|DROP|SET", "ALL", "TABLES", "IN", "SCHEMA")) ... and perhaps make this "ALL", "TABLES|SEQUENCES", "IN", "SCHEMA". -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Nunca confiaré en un traidor. Ni siquiera si el traidor lo he creado yo" (Barón Vladimir Harkonnen)