diff options
author | Amit Kapila <akapila@postgresql.org> | 2021-01-25 07:39:29 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2021-01-25 07:39:29 +0530 |
commit | 40ab64c1ec1cb9bd73695f519cf66ddbb97d8144 (patch) | |
tree | 38e2b7bafef26b0a7256701f6a490802c77a751d /src/backend/replication/pgoutput/pgoutput.c | |
parent | a4b03de589c1df0845e9732da203f505f2eedb6d (diff) | |
download | postgresql-40ab64c1ec1cb9bd73695f519cf66ddbb97d8144.tar.gz postgresql-40ab64c1ec1cb9bd73695f519cf66ddbb97d8144.zip |
Fix ALTER PUBLICATION...DROP TABLE behavior.
Commit 69bd60672 fixed the initialization of streamed transactions for
RelationSyncEntry. It forgot to initialize the publication actions while
invalidating the RelationSyncEntry due to which even though the relation
is dropped from a particular publication we still publish its changes. Fix
it by initializing pubactions when entry got invalidated.
Author: Japin Li and Bharath Rupireddy
Reviewed-by: Amit Kapila
Discussion: https://postgr.es/m/CALj2ACV+0UFpcZs5czYgBpujM9p0Hg1qdOZai_43OU7bqHU_xw@mail.gmail.com
Diffstat (limited to 'src/backend/replication/pgoutput/pgoutput.c')
-rw-r--r-- | src/backend/replication/pgoutput/pgoutput.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/replication/pgoutput/pgoutput.c b/src/backend/replication/pgoutput/pgoutput.c index 2f01137b426..79765f96969 100644 --- a/src/backend/replication/pgoutput/pgoutput.c +++ b/src/backend/replication/pgoutput/pgoutput.c @@ -1179,5 +1179,16 @@ rel_sync_cache_publication_cb(Datum arg, int cacheid, uint32 hashvalue) */ hash_seq_init(&status, RelationSyncCache); while ((entry = (RelationSyncEntry *) hash_seq_search(&status)) != NULL) + { entry->replicate_valid = false; + + /* + * There might be some relations dropped from the publication so we + * don't need to publish the changes for them. + */ + entry->pubactions.pubinsert = false; + entry->pubactions.pubupdate = false; + entry->pubactions.pubdelete = false; + entry->pubactions.pubtruncate = false; + } } |