From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | pgsql: Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING |
Date: | 2022-01-22 18:33:00 |
Message-ID: | E1nBLC8-0004un-0E@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX.
Previously, unless we had to add a NOT NULL constraint to the column,
this command resulted in updating only the index's relcache entry.
That's problematic when replication behavior is being driven off the
existence of a primary key: other sessions (and ours too for that
matter) failed to recalculate their opinion of whether the table can
be replicated. Add a relcache invalidation to fix it.
This has been broken since pg_class.relhaspkey was removed in v11.
Before that, updating the table's relhaspkey value sufficed to cause
a cache flush. Hence, backpatch to v11.
Report and patch by Hou Zhijie
Discussion: https://postgr.es/m/OS0PR01MB5716EBE01F112C62F8F9B786947B9@OS0PR01MB5716.jpnprd01.prod.outlook.com
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/e2d53c8767da9f98c7c4c8d0b129171848472c93
Modified Files
--------------
src/backend/catalog/index.c | 11 +++++++++++
src/test/regress/expected/publication.out | 14 ++++++++++++++
src/test/regress/sql/publication.sql | 13 +++++++++++++
3 files changed, 38 insertions(+)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-01-22 20:44:59 | pgsql: Doc: add cross-references between array_to_string and string_to_ |
Previous Message | Tom Lane | 2022-01-22 18:32:59 | pgsql: Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING |