postgresql/src
Noah Misch 941e0c0df2 Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE.
This WARNING appeared because SearchSysCacheLocked1() read
cc_relisshared before catcache initialization, when the field is false
unconditionally.  On the basis of reading false there, it constructed a
locktag as though pg_tablespace weren't relisshared.  Only shared
catalogs could be affected, and only GRANT TABLESPACE was affected in
practice.  SearchSysCacheLocked1() callers use one other shared-relation
syscache, DATABASEOID.  DATABASEOID is initialized by the end of
CheckMyDatabase(), making the problem unreachable for pg_database.

Back-patch to v13 (all supported versions).  This has no known impact
before v16, where ExecGrant_common() first appeared.  Earlier branches
avoid trouble by having a separate ExecGrant_Tablespace() that doesn't
use LOCKTAG_TUPLE.  However, leaving this unfixed in v15 could ensnare a
future back-patch of a SearchSysCacheLocked1() call.

Reported by Aya Iwata.

Discussion: https://postgr.es/m/OS7PR01MB11964507B5548245A7EE54E70EA212@OS7PR01MB11964.jpnprd01.prod.outlook.com
2024-11-25 14:42:39 -08:00
..
backend Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. 2024-11-25 14:42:39 -08:00
bin Fix newly introduced 010_keep_recycled_wals.pl 2024-11-21 17:06:53 +01:00
common Replace pgwin32_is_junction() with lstat(). 2024-11-08 09:29:40 +10:30
fe_utils Prevent mis-encoding of "trailing junk after numeric literal" errors. 2024-09-05 12:42:33 -04:00
include Assume that <stdbool.h> conforms to the C standard. 2024-11-25 20:53:55 +13:00
interfaces Translation updates 2024-11-11 13:55:53 +01:00
makefiles Refactor DLSUFFIX handling 2022-03-25 08:56:02 +01:00
pl Add support for Tcl 9 2024-11-25 12:27:26 +01:00
port Make unlink() work for junction points on Windows. 2024-11-08 09:30:09 +10:30
template On NetBSD, force dynamic symbol resolution at postmaster start. 2022-08-30 17:28:55 -04:00
test Avoid "you don't own a lock of type ExclusiveLock" in GRANT TABLESPACE. 2024-11-25 14:42:39 -08:00
timezone Update time zone data files to tzdata release 2024b. 2024-10-29 11:50:00 -04:00
tools Assume that <stdbool.h> conforms to the C standard. 2024-11-25 20:53:55 +13:00
tutorial Doc: sync src/tutorial/basics.source with SGML documentation. 2022-11-19 13:09:14 -05:00
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Suppress macOS warnings about duplicate libraries in link commands. 2023-09-29 14:07:30 -04:00
Makefile.shlib Stop using "-multiply_defined suppress" on macOS. 2023-09-26 21:06:21 -04:00
nls-global.mk Improve frontend error logging style. 2022-04-08 14:55:14 -04:00