pgsql: Invalidate all partitions for a partitioned table in publication

From: Amit Kapila <akapila(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Invalidate all partitions for a partitioned table in publication
Date: 2021-09-22 03:03:57
Message-ID: E1mSsY9-0000Wr-Iq@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Invalidate all partitions for a partitioned table in publication.

Updates/Deletes on a partition were allowed even without replica identity
after the parent table was added to a publication. This would later lead
to an error on subscribers. The reason was that we were not invalidating
the partition's relcache and the publication information for partitions
was not getting rebuilt. Similarly, we were not invalidating the
partitions' relcache after dropping a partitioned table from a publication
which will prohibit Updates/Deletes on its partition without replica
identity even without any publication.

Reported-by: Haiying Tang
Author: Hou Zhijie and Vignesh C
Reviewed-by: Vignesh C and Amit Kapila
Backpatch-through: 13
Discussion: https://postgr.es/m/OS0PR01MB6113D77F583C922F1CEAA1C3FBD29@OS0PR01MB6113.jpnprd01.prod.outlook.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9eff8593265929d3a1fcdee375bd0a801c12b367

Modified Files
--------------
src/backend/catalog/pg_publication.c | 82 ++++++++++++++++++++-----------
src/backend/commands/publicationcmds.c | 57 ++++++++++++---------
src/include/catalog/pg_publication.h | 3 ++
src/include/commands/publicationcmds.h | 5 ++
src/test/regress/expected/publication.out | 13 ++++-
src/test/regress/sql/publication.sql | 11 ++++-
6 files changed, 116 insertions(+), 55 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2021-09-22 05:32:08 pgsql: Make use of PG_INT64_MAX/PG_INT64_MIN
Previous Message Amit Kapila 2021-09-22 02:24:18 pgsql: Add parent table name in an error in reorderbuffer.c.