summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas Munro <tmunro@postgresql.org>2021-05-29 14:48:15 +1200
committerThomas Munro <tmunro@postgresql.org>2021-05-29 15:13:44 +1200
commitd41fda6aa3c1016ef5aedb4bf393ead81f6e3a8f (patch)
tree0f1a4cc7463f811d29089a142d038b8da98164dd /src
parentbb18bc2249239fff10f84c276783962d546c858a (diff)
Fix race condition when sharing tuple descriptors.
Parallel query processes that called BlessTupleDesc() for identical tuple descriptors at the same moment could crash. There was code to handle that rare case, but it dereferenced a bogus DSA pointer. Repair. Back-patch to 11, where commit cc5f8136 added support for sharing tuple descriptors in parallel queries. Reported-by: Eric Thinnes <e.thinnes@gmx.de> Discussion: https://postgr.es/m/99aaa2eb-e194-bf07-c29a-1a76b4f2bcf9%40gmx.de
Diffstat (limited to 'src')
-rw-r--r--src/backend/utils/cache/typcache.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/utils/cache/typcache.c b/src/backend/utils/cache/typcache.c
index f51248b70d0..c848d09d14b 100644
--- a/src/backend/utils/cache/typcache.c
+++ b/src/backend/utils/cache/typcache.c
@@ -2707,7 +2707,7 @@ find_or_make_matching_shared_tupledesc(TupleDesc tupdesc)
Assert(record_table_entry->key.shared);
result = (TupleDesc)
dsa_get_address(CurrentSession->area,
- record_table_entry->key.shared);
+ record_table_entry->key.u.shared_tupdesc);
Assert(result->tdrefcount == -1);
return result;