From ebb4745e6d086ab5fcbf84ddf909657bd54f93a1 Mon Sep 17 00:00:00 2001 From: Kuntal Ghosh 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