Re: logical decoding and replication of sequences
Tomas Vondra <tomas.vondra@enterprisedb.com>
From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: vignesh C <vignesh21@gmail.com>
Cc: Petr Jelinek <petr.jelinek@enterprisedb.com>,
Amit Kapila <amit.kapila16@gmail.com>,
Peter Eisentraut <peter.eisentraut@enterprisedb.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-03-25T19:58:11Z
Lists: pgsql-hackers
On 3/25/22 15:34, vignesh C wrote:
> On Fri, Mar 25, 2022 at 3:29 AM Tomas Vondra
> <tomas.vondra@enterprisedb.com> wrote:
>>
>> Hi,
>>
>> Pushed, after going through the patch once more, addressed the remaining
>> FIXMEs, corrected a couple places in the docs and comments, etc. Minor
>> tweaks, nothing important.
>
> While rebasing patch [1] I found a couple of comments:
> static void
> ObjectsInPublicationToOids(List *pubobjspec_list, ParseState *pstate,
> - List **rels, List **schemas)
> + List **tables, List **sequences,
> + List **tables_schemas, List **sequences_schemas,
> + List **schemas)
> {
> ListCell *cell;
> PublicationObjSpec *pubobj;
> @@ -185,12 +194,23 @@ ObjectsInPublicationToOids(List
> *pubobjspec_list, ParseState *pstate,
> switch (pubobj->pubobjtype)
> {
> case PUBLICATIONOBJ_TABLE:
> - *rels = lappend(*rels, pubobj->pubtable);
> + *tables = lappend(*tables, pubobj->pubtable);
> + break;
> + case PUBLICATIONOBJ_SEQUENCE:
> + *sequences = lappend(*sequences, pubobj->pubtable);
> break;
> case PUBLICATIONOBJ_TABLES_IN_SCHEMA:
> schemaid = get_namespace_oid(pubobj->name, false);
>
> /* Filter out duplicates if user specifies "sch1, sch1" */
> + *tables_schemas = list_append_unique_oid(*tables_schemas, schemaid);
> + *schemas = list_append_unique_oid(*schemas, schemaid);
> + break;
>
> Now tables_schemas and sequence_schemas are being updated and used in
> ObjectsInPublicationToOids, schema parameter is no longer being used
> after processing in ObjectsInPublicationToOids, I felt we can remove
> that parameter.
>
Thanks! That's a nice simplification, I'll get that pushed in a couple
minutes.
> /* ALTER PUBLICATION <name> ADD */
> else if (Matches("ALTER", "PUBLICATION", MatchAny, "ADD"))
> - COMPLETE_WITH("ALL TABLES IN SCHEMA", "TABLE");
> + COMPLETE_WITH("ALL TABLES IN SCHEMA", "ALL SEQUENCES IN SCHEMA",
> "TABLE", "SEQUENCE");
>
> Tab completion of alter publication for ADD and DROP is the same, we
> could combine it.
>
We could, but I find these combined rules harder to read, so I'll keep
the current tab-completion.
> Attached a patch for the same.
> Thoughts?
Thanks for taking a look! Appreciated.
>
> [1] - https://www.postgresql.org/message-id/CALDaNm3%3DJrucjhiiwsYQw5-PGtBHFONa6F7hhWCXMsGvh%3DtamA%40mail.gmail.com
>
regars
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
Commits
-
Fix cache invalidation bug in recovery_prefetch.
- d0d934490020 15.0 landed
- 932b01630095 16.0 landed
-
Revert "Logical decoding of sequences"
- 2c7ea57e56ca 15.0 landed
-
Minor improvements in sequence decoding code and docs
- 05843b1aa49d 15.0 landed
-
Handle sequences in preprocess_pubobj_list
- 002c9dd97a0c 15.0 landed
-
Update tab-completion for CREATE PUBLICATION with sequences
- 2d2232933b02 15.0 landed
-
Add decoding of sequences to built-in replication
- 75b1521dae1f 15.0 landed
-
Stabilize test_decoding touching with sequences
- a180c2b34de0 15.0 landed
-
Call ReorderBufferProcessXid from sequence_decode
- d5ed9da41d96 15.0 landed
-
Add decoding of sequences to test_decoding
- 80901b32913f 15.0 landed
-
Replace Test::More plans with done_testing
- 549ec201d613 15.0 cited
-
Logical decoding of sequences
- 0da92dc530c9 15.0 landed
-
Respect permissions within logical replication.
- a2ab9c06ea15 15.0 cited