|
35 | 35 | #include "catalog/pg_inherits.h" |
36 | 36 | #include "catalog/pg_namespace.h" |
37 | 37 | #include "catalog/pg_opclass.h" |
38 | | -#include "catalog/pg_opfamily.h" |
39 | 38 | #include "catalog/pg_tablespace.h" |
40 | 39 | #include "catalog/pg_type.h" |
41 | 40 | #include "commands/comment.h" |
@@ -2147,29 +2146,12 @@ ComputeIndexAttrs(IndexInfo *indexInfo, |
2147 | 2146 | opfamily = get_opclass_family(opclassOids[attn]); |
2148 | 2147 | strat = get_op_opfamily_strategy(opid, opfamily); |
2149 | 2148 | if (strat == 0) |
2150 | | - { |
2151 | | - HeapTuple opftuple; |
2152 | | - Form_pg_opfamily opfform; |
2153 | | - |
2154 | | - /* |
2155 | | - * attribute->opclass might not explicitly name the opfamily, |
2156 | | - * so fetch the name of the selected opfamily for use in the |
2157 | | - * error message. |
2158 | | - */ |
2159 | | - opftuple = SearchSysCache1(OPFAMILYOID, |
2160 | | - ObjectIdGetDatum(opfamily)); |
2161 | | - if (!HeapTupleIsValid(opftuple)) |
2162 | | - elog(ERROR, "cache lookup failed for opfamily %u", |
2163 | | - opfamily); |
2164 | | - opfform = (Form_pg_opfamily) GETSTRUCT(opftuple); |
2165 | | - |
2166 | 2149 | ereport(ERROR, |
2167 | 2150 | (errcode(ERRCODE_WRONG_OBJECT_TYPE), |
2168 | 2151 | errmsg("operator %s is not a member of operator family \"%s\"", |
2169 | 2152 | format_operator(opid), |
2170 | | - NameStr(opfform->opfname)), |
| 2153 | + get_opfamily_name(opfamily, false)), |
2171 | 2154 | errdetail("The exclusion operator must be related to the index operator class for the constraint."))); |
2172 | | - } |
2173 | 2155 |
|
2174 | 2156 | indexInfo->ii_ExclusionOps[attn] = opid; |
2175 | 2157 | indexInfo->ii_ExclusionProcs[attn] = get_opcode(opid); |
@@ -2484,21 +2466,13 @@ GetOperatorFromCompareType(Oid opclass, Oid rhstype, CompareType cmptype, |
2484 | 2466 | } |
2485 | 2467 |
|
2486 | 2468 | if (!OidIsValid(*opid)) |
2487 | | - { |
2488 | | - HeapTuple tuple; |
2489 | | - |
2490 | | - tuple = SearchSysCache1(OPFAMILYOID, ObjectIdGetDatum(opfamily)); |
2491 | | - if (!HeapTupleIsValid(tuple)) |
2492 | | - elog(ERROR, "cache lookup failed for operator family %u", opfamily); |
2493 | | - |
2494 | 2469 | ereport(ERROR, |
2495 | 2470 | errcode(ERRCODE_UNDEFINED_OBJECT), |
2496 | 2471 | cmptype == COMPARE_EQ ? errmsg("could not identify an equality operator for type %s", format_type_be(opcintype)) : |
2497 | 2472 | cmptype == COMPARE_OVERLAP ? errmsg("could not identify an overlaps operator for type %s", format_type_be(opcintype)) : |
2498 | 2473 | cmptype == COMPARE_CONTAINED_BY ? errmsg("could not identify a contained-by operator for type %s", format_type_be(opcintype)) : 0, |
2499 | 2474 | errdetail("There is no suitable operator in operator family \"%s\" for access method \"%s\".", |
2500 | | - NameStr(((Form_pg_opfamily) GETSTRUCT(tuple))->opfname), "gist")); |
2501 | | - } |
| 2475 | + get_opfamily_name(opfamily, false), "gist")); |
2502 | 2476 | } |
2503 | 2477 |
|
2504 | 2478 | /* |
|
0 commit comments