postgresql/src/backend
Tom Lane 31b7b4d26e 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
2022-01-22 13:32:40 -05:00
..
access fsync pg_logical/mappings in CheckPointLogicalRewriteHeap(). 2022-01-21 11:24:12 -08:00
bootstrap Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
catalog Flush table's relcache during ALTER TABLE ADD PRIMARY KEY USING INDEX. 2022-01-22 13:32:40 -05:00
commands Build inherited extended stats on partitioned tables 2022-01-15 19:14:00 +01:00
executor Fix index-only scan plans, take 2. 2022-01-03 15:42:27 -05:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit Avoid some other O(N^2) hazards in list manipulation. 2021-11-01 16:24:40 -04:00
lib Fix typo in comment 2021-04-20 14:36:41 +02:00
libpq On Windows, also call shutdown() while closing the client socket. 2021-12-07 13:34:19 -05:00
main Add PostgreSQL home page to --help output 2020-02-28 13:12:21 +01:00
nodes Fix index-only scan plans, take 2. 2022-01-03 15:42:27 -05:00
optimizer Fix index-only scan plans, take 2. 2022-01-03 15:42:27 -05:00
parser Ensure casting to typmod -1 generates a RelabelType. 2021-12-16 15:36:02 -05:00
partitioning Avoid using ambiguous word "non-negative" in error messages. 2021-07-28 01:21:52 +09:00
po Fix typo 2021-11-08 09:17:24 -03:00
port Reject huge_pages=on if shared_memory_type=sysv. 2021-10-26 13:04:40 +13:00
postmaster Reject extraneous data after SSL or GSS encryption handshake. 2021-11-08 11:01:43 -05:00
regex Make pg_regexec() robust against out-of-range search_start. 2021-09-11 15:19:49 -04:00
replication Reduce relcache access in WAL sender streaming logical changes 2022-01-05 10:27:53 +09:00
rewrite Fix rewriter to set hasModifyingCTE correctly on rewritten queries. 2021-09-08 12:05:43 -04:00
snowball Update copyrights for 2020 2020-01-01 12:21:45 -05:00
statistics Build inherited extended stats on partitioned tables 2022-01-15 19:14:00 +01:00
storage Fix parallel operations that prevent oldest xmin from advancing. 2021-11-19 09:24:00 +05:30
tcop Fix Portal snapshot tracking to handle subtransactions properly. 2021-10-01 11:10:12 -04:00
tsearch Don't leak compiled regex(es) when an ispell cache entry is dropped. 2021-03-18 21:44:43 -04:00
utils Build inherited extended stats on partitioned tables 2022-01-15 19:14:00 +01:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Update copyrights for 2020 2020-01-01 12:21:45 -05:00
nls.mk Translation updates 2020-09-14 13:14:53 +02:00