0001-Fix-creation-of-partition-descriptor-during-concurre.patch
application/octet-stream
Filename: 0001-Fix-creation-of-partition-descriptor-during-concurre.patch
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: Fix creation of partition descriptor during concurrent detach
| File | + | − |
|---|---|---|
| src/backend/partitioning/partdesc.c | 9 | 4 |
From ebb4745e6d086ab5fcbf84ddf909657bd54f93a1 Mon Sep 17 00:00:00 2001
From: Kuntal Ghosh <kuntalgh@amazon.com>
Date: Tue, 30 Jul 2024 13:44:02 +0000
Subject: [PATCH] Fix creation of partition descriptor during concurrent detach
---
src/backend/partitioning/partdesc.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/backend/partitioning/partdesc.c b/src/backend/partitioning/partdesc.c
index c661a303bf..7c8481a061 100644
--- a/src/backend/partitioning/partdesc.c
+++ b/src/backend/partitioning/partdesc.c
@@ -234,10 +234,15 @@ retry:
scan = systable_beginscan(pg_class, ClassOidIndexId, true,
NULL, 1, key);
tuple = systable_getnext(scan);
- datum = heap_getattr(tuple, Anum_pg_class_relpartbound,
- RelationGetDescr(pg_class), &isnull);
- if (!isnull)
- boundspec = stringToNode(TextDatumGetCString(datum));
+
+ /* The partition could be dropped as well. */
+ if (HeapTupleIsValid(tuple))
+ {
+ datum = heap_getattr(tuple, Anum_pg_class_relpartbound,
+ RelationGetDescr(pg_class), &isnull);
+ if (!isnull)
+ boundspec = stringToNode(TextDatumGetCString(datum));
+ }
systable_endscan(scan);
table_close(pg_class, AccessShareLock);
--
2.40.1