Invalidate all partitions for a partitioned table in publication.
authorAmit Kapila <akapila@postgresql.org>
Wed, 22 Sep 2021 02:30:54 +0000 (08:00 +0530)
committerAmit Kapila <akapila@postgresql.org>
Wed, 22 Sep 2021 02:30:54 +0000 (08:00 +0530)
commit4548c76738b368a11a5dad052f9653a349eeb52c
tree092a834c78cbe2006f9ae24d9e2786990618fb2e
parent5e77625b260a781316bb94ea9750dc66c50152bf
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
src/backend/catalog/pg_publication.c
src/backend/commands/publicationcmds.c
src/include/catalog/pg_publication.h
src/include/commands/publicationcmds.h
src/test/regress/expected/publication.out
src/test/regress/sql/publication.sql