agora inbox for [email protected]
help / color / mirror / Atom feedFrom: Justin Pryzby <[email protected]>
Subject: [PATCH 2/2] index_get_partition(): use lsyscache ??
Date: Thu, 5 Nov 2020 12:14:24 -0600
The old code failed when !HeapTupleIsValid(), the new code will return false -
is that ok ??
---
src/backend/catalog/partition.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/src/backend/catalog/partition.c b/src/backend/catalog/partition.c
index 4dfac39adf..3d78bc0872 100644
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -28,6 +28,7 @@
#include "partitioning/partbounds.h"
#include "rewrite/rewriteManip.h"
#include "utils/fmgroids.h"
+#include "utils/lsyscache.h"
#include "utils/partcache.h"
#include "utils/rel.h"
#include "utils/syscache.h"
@@ -158,17 +159,8 @@ index_get_partition(Relation partition, Oid indexId)
foreach(l, idxlist)
{
Oid partIdx = lfirst_oid(l);
- HeapTuple tup;
- Form_pg_class classForm;
- bool ispartition;
-
- tup = SearchSysCache1(RELOID, ObjectIdGetDatum(partIdx));
- if (!HeapTupleIsValid(tup))
- elog(ERROR, "cache lookup failed for relation %u", partIdx);
- classForm = (Form_pg_class) GETSTRUCT(tup);
- ispartition = classForm->relispartition;
- ReleaseSysCache(tup);
- if (!ispartition)
+
+ if (!get_rel_relispartition(partIdx))
continue;
if (get_partition_parent(partIdx) == indexId)
{
--
2.17.0
--6K2R/cS9K4qvcBNq--
view thread (2+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH 2/2] index_get_partition(): use lsyscache ??
In-Reply-To: <no-message-id-183704@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox