postgresql/src
Noah Misch 0cecc908e9 Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX.
Commit 5b562644fe added a comment that
SetRelationHasSubclass() callers must hold this lock.  When commit
17f206fbc8 extended use of this column to
partitioned indexes, it didn't take the lock.  As the latter commit
message mentioned, we currently never reset a partitioned index to
relhassubclass=f.  That largely avoids harm from the lock omission.  The
cause for fixing this now is to unblock introducing a rule about locks
required to heap_update() a pg_class row.  This might cause more
deadlocks.  It gives minor user-visible benefits:

- If an ALTER INDEX SET TABLESPACE runs concurrently with ALTER TABLE
  ATTACH PARTITION or CREATE PARTITION OF, one transaction blocks
  instead of failing with "tuple concurrently updated".  (Many cases of
  DDL concurrency still fail that way.)

- Match ALTER INDEX ATTACH PARTITION in choosing to lock the index.

While not user-visible today, we'll need this if we ever make something
set the flag to false for a partitioned index, like ANALYZE does today
for tables.  Back-patch to v12 (all supported versions), the plan for
the commit relying on the new rule.  In back branches, add
LockOrStrongerHeldByMe() instead of adding a LockHeldByMe() parameter.

Reviewed (in an earlier version) by Robert Haas.

Discussion: https://postgr.es/m/20240611024525.9f.nmisch@google.com
2024-06-27 19:21:05 -07:00
..
backend Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX. 2024-06-27 19:21:05 -07:00
bin Improve test coverage for changes to inplace-updated catalogs. 2024-06-27 19:21:05 -07:00
common parse_manifest: Use const char * 2024-06-21 07:53:30 +02:00
fe_utils Fix PL/pgSQL's handling of integer ranges containing underscores. 2024-06-04 11:48:01 +01:00
include Lock before setting relhassubclass on RELKIND_PARTITIONED_INDEX. 2024-06-27 19:21:05 -07:00
interfaces Use PqMsg_* macros in fe-auth.c. 2024-06-26 11:25:38 -05:00
makefiles Optimize pg_popcount() with AVX-512 instructions. 2024-04-06 21:56:23 -05:00
pl Translation updates 2024-06-24 13:11:27 +02:00
port Pre-beta mechanical code beautification. 2024-05-14 16:34:50 -04:00
template Remove AIX support 2024-02-28 15:17:23 +04:00
test Add an injection_points isolation test suite. 2024-06-27 19:21:05 -07:00
timezone Update time zone data files to tzdata release 2024a. 2024-02-01 15:57:53 -05:00
tools Add wait event type "InjectionPoint", a custom type like "Extension". 2024-06-27 19:21:05 -07:00
tutorial Update copyright for 2024 2024-01-03 20:49:05 -05:00
.gitignore
DEVELOPERS
Makefile Remove distprep 2023-11-06 15:18:04 +01:00
Makefile.global.in Update Unicode data to CLDR 45 2024-04-22 09:16:33 +02:00
Makefile.shlib Remove AIX support 2024-02-28 15:17:23 +04:00
meson.build Update copyright for 2024 2024-01-03 20:49:05 -05:00
nls-global.mk Remove distprep 2023-11-06 15:18:04 +01:00