diff options
author | Peter Eisentraut <peter@eisentraut.org> | 2025-01-24 22:58:13 +0100 |
---|---|---|
committer | Peter Eisentraut <peter@eisentraut.org> | 2025-02-01 10:42:58 +0100 |
commit | 43493cceda2fb75e07a63cec46000407661d505d (patch) | |
tree | 0c8c0f8d1a109ccd7fb7b4ec45ced857e379f0fe /src/backend/access/gist/gistvalidate.c | |
parent | a5709b5bb293a554913c4b1f6a9c58d1915ba3f7 (diff) | |
download | postgresql-43493cceda2fb75e07a63cec46000407661d505d.tar.gz postgresql-43493cceda2fb75e07a63cec46000407661d505d.zip |
Add get_opfamily_name() function
This refactors and simplifies various existing code to make use of the
new function.
Reviewed-by: Mark Dilger <mark.dilger@enterprisedb.com>
Discussion: https://www.postgresql.org/message-id/flat/E72EAA49-354D-4C2E-8EB9-255197F55330@enterprisedb.com
Diffstat (limited to 'src/backend/access/gist/gistvalidate.c')
-rw-r--r-- | src/backend/access/gist/gistvalidate.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/backend/access/gist/gistvalidate.c b/src/backend/access/gist/gistvalidate.c index bb86b559486..ffefa12d97a 100644 --- a/src/backend/access/gist/gistvalidate.c +++ b/src/backend/access/gist/gistvalidate.c @@ -19,7 +19,6 @@ #include "catalog/pg_amop.h" #include "catalog/pg_amproc.h" #include "catalog/pg_opclass.h" -#include "catalog/pg_opfamily.h" #include "catalog/pg_type.h" #include "utils/lsyscache.h" #include "utils/regproc.h" @@ -39,8 +38,6 @@ gistvalidate(Oid opclassoid) Oid opcintype; Oid opckeytype; char *opclassname; - HeapTuple familytup; - Form_pg_opfamily familyform; char *opfamilyname; CatCList *proclist, *oprlist; @@ -63,12 +60,7 @@ gistvalidate(Oid opclassoid) opclassname = NameStr(classform->opcname); /* Fetch opfamily information */ - familytup = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamilyoid)); - if (!HeapTupleIsValid(familytup)) - elog(ERROR, "cache lookup failed for operator family %u", opfamilyoid); - familyform = (Form_pg_opfamily) GETSTRUCT(familytup); - - opfamilyname = NameStr(familyform->opfname); + opfamilyname = get_opfamily_name(opfamilyoid, false); /* Fetch all operators and support functions of the opfamily */ oprlist = SearchSysCacheList1(AMOPSTRATEGY, ObjectIdGetDatum(opfamilyoid)); @@ -282,7 +274,6 @@ gistvalidate(Oid opclassoid) ReleaseCatCacheList(proclist); ReleaseCatCacheList(oprlist); - ReleaseSysCache(familytup); ReleaseSysCache(classtup); return result; |