PostgreSQL Source Code git master
Loading...
Searching...
No Matches
lsyscache.h File Reference
#include "access/attnum.h"
#include "access/cmptype.h"
#include "access/htup.h"
#include "nodes/pg_list.h"
Include dependency graph for lsyscache.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  OpIndexInterpretation
 
struct  AttStatsSlot
 

Macros

#define ATTSTATSSLOT_VALUES   0x01
 
#define ATTSTATSSLOT_NUMBERS   0x02
 
#define type_is_array(typid)   (get_element_type(typid) != InvalidOid)
 
#define type_is_array_domain(typid)   (get_base_element_type(typid) != InvalidOid)
 
#define TypeIsToastable(typid)   (get_typstorage(typid) != TYPSTORAGE_PLAIN)
 

Typedefs

typedef struct SubscriptRoutines SubscriptRoutines
 
typedef struct OpIndexInterpretation OpIndexInterpretation
 
typedef enum IOFuncSelector IOFuncSelector
 
typedef struct AttStatsSlot AttStatsSlot
 
typedef int32(* get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum)
 

Enumerations

enum  IOFuncSelector { IOFunc_input , IOFunc_output , IOFunc_receive , IOFunc_send }
 

Functions

bool op_in_opfamily (Oid opno, Oid opfamily)
 
int get_op_opfamily_strategy (Oid opno, Oid opfamily)
 
Oid get_op_opfamily_sortfamily (Oid opno, Oid opfamily)
 
void get_op_opfamily_properties (Oid opno, Oid opfamily, bool ordering_op, int *strategy, Oid *lefttype, Oid *righttype)
 
Oid get_opfamily_member (Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
 
Oid get_opfamily_member_for_cmptype (Oid opfamily, Oid lefttype, Oid righttype, CompareType cmptype)
 
bool get_ordering_op_properties (Oid opno, Oid *opfamily, Oid *opcintype, CompareType *cmptype)
 
Oid get_equality_op_for_ordering_op (Oid opno, bool *reverse)
 
Oid get_ordering_op_for_equality_op (Oid opno, bool use_lhs_type)
 
Listget_mergejoin_opfamilies (Oid opno)
 
bool get_compatible_hash_operators (Oid opno, Oid *lhs_opno, Oid *rhs_opno)
 
bool get_op_hash_functions (Oid opno, RegProcedure *lhs_procno, RegProcedure *rhs_procno)
 
Listget_op_index_interpretation (Oid opno)
 
bool equality_ops_are_compatible (Oid opno1, Oid opno2)
 
bool comparison_ops_are_compatible (Oid opno1, Oid opno2)
 
bool op_is_safe_index_member (Oid opno)
 
Oid get_opfamily_proc (Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
 
charget_attname (Oid relid, AttrNumber attnum, bool missing_ok)
 
AttrNumber get_attnum (Oid relid, const char *attname)
 
char get_attgenerated (Oid relid, AttrNumber attnum)
 
Oid get_atttype (Oid relid, AttrNumber attnum)
 
void get_atttypetypmodcoll (Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid)
 
Datum get_attoptions (Oid relid, int16 attnum)
 
Oid get_cast_oid (Oid sourcetypeid, Oid targettypeid, bool missing_ok)
 
charget_collation_name (Oid colloid)
 
bool get_collation_isdeterministic (Oid colloid)
 
charget_constraint_name (Oid conoid)
 
Oid get_constraint_index (Oid conoid)
 
char get_constraint_type (Oid conoid)
 
charget_database_name (Oid dbid)
 
charget_language_name (Oid langoid, bool missing_ok)
 
Oid get_opclass_family (Oid opclass)
 
Oid get_opclass_input_type (Oid opclass)
 
bool get_opclass_opfamily_and_input_type (Oid opclass, Oid *opfamily, Oid *opcintype)
 
Oid get_opclass_method (Oid opclass)
 
Oid get_opfamily_method (Oid opfid)
 
charget_opfamily_name (Oid opfid, bool missing_ok)
 
RegProcedure get_opcode (Oid opno)
 
charget_opname (Oid opno)
 
Oid get_op_rettype (Oid opno)
 
void op_input_types (Oid opno, Oid *lefttype, Oid *righttype)
 
bool op_mergejoinable (Oid opno, Oid inputtype)
 
bool op_hashjoinable (Oid opno, Oid inputtype)
 
bool op_strict (Oid opno)
 
char op_volatile (Oid opno)
 
Oid get_commutator (Oid opno)
 
Oid get_negator (Oid opno)
 
RegProcedure get_oprrest (Oid opno)
 
RegProcedure get_oprjoin (Oid opno)
 
charget_func_name (Oid funcid)
 
Oid get_func_namespace (Oid funcid)
 
Oid get_func_rettype (Oid funcid)
 
int get_func_nargs (Oid funcid)
 
Oid get_func_signature (Oid funcid, Oid **argtypes, int *nargs)
 
Oid get_func_variadictype (Oid funcid)
 
bool get_func_retset (Oid funcid)
 
bool func_strict (Oid funcid)
 
char func_volatile (Oid funcid)
 
char func_parallel (Oid funcid)
 
char get_func_prokind (Oid funcid)
 
bool get_func_leakproof (Oid funcid)
 
RegProcedure get_func_support (Oid funcid)
 
Oid get_relname_relid (const char *relname, Oid relnamespace)
 
charget_rel_name (Oid relid)
 
Oid get_rel_namespace (Oid relid)
 
Oid get_rel_type_id (Oid relid)
 
char get_rel_relkind (Oid relid)
 
bool get_rel_relispartition (Oid relid)
 
Oid get_rel_tablespace (Oid relid)
 
char get_rel_persistence (Oid relid)
 
Oid get_rel_relam (Oid relid)
 
Oid get_transform_fromsql (Oid typid, Oid langid, List *trftypes)
 
Oid get_transform_tosql (Oid typid, Oid langid, List *trftypes)
 
bool get_typisdefined (Oid typid)
 
int16 get_typlen (Oid typid)
 
bool get_typbyval (Oid typid)
 
void get_typlenbyval (Oid typid, int16 *typlen, bool *typbyval)
 
void get_typlenbyvalalign (Oid typid, int16 *typlen, bool *typbyval, char *typalign)
 
Oid getTypeIOParam (HeapTuple typeTuple)
 
void get_type_io_data (Oid typid, IOFuncSelector which_func, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *func)
 
char get_typstorage (Oid typid)
 
Nodeget_typdefault (Oid typid)
 
char get_typtype (Oid typid)
 
bool type_is_rowtype (Oid typid)
 
bool type_is_enum (Oid typid)
 
bool type_is_range (Oid typid)
 
bool type_is_multirange (Oid typid)
 
void get_type_category_preferred (Oid typid, char *typcategory, bool *typispreferred)
 
Oid get_typ_typrelid (Oid typid)
 
Oid get_element_type (Oid typid)
 
Oid get_array_type (Oid typid)
 
Oid get_promoted_array_type (Oid typid)
 
Oid get_base_element_type (Oid typid)
 
void getTypeInputInfo (Oid type, Oid *typInput, Oid *typIOParam)
 
void getTypeOutputInfo (Oid type, Oid *typOutput, bool *typIsVarlena)
 
void getTypeBinaryInputInfo (Oid type, Oid *typReceive, Oid *typIOParam)
 
void getTypeBinaryOutputInfo (Oid type, Oid *typSend, bool *typIsVarlena)
 
Oid get_typmodin (Oid typid)
 
Oid get_typcollation (Oid typid)
 
bool type_is_collatable (Oid typid)
 
RegProcedure get_typsubscript (Oid typid, Oid *typelemp)
 
const SubscriptRoutinesgetSubscriptingRoutines (Oid typid, Oid *typelemp)
 
Oid getBaseType (Oid typid)
 
Oid getBaseTypeAndTypmod (Oid typid, int32 *typmod)
 
int32 get_typavgwidth (Oid typid, int32 typmod)
 
int32 get_attavgwidth (Oid relid, AttrNumber attnum)
 
bool get_attstatsslot (AttStatsSlot *sslot, HeapTuple statstuple, int reqkind, Oid reqop, int flags)
 
void free_attstatsslot (AttStatsSlot *sslot)
 
charget_namespace_name (Oid nspid)
 
charget_namespace_name_or_temp (Oid nspid)
 
Oid get_range_subtype (Oid rangeOid)
 
Oid get_range_collation (Oid rangeOid)
 
Oid get_range_constructor2 (Oid rangeOid)
 
Oid get_range_multirange (Oid rangeOid)
 
Oid get_multirange_range (Oid multirangeOid)
 
Oid get_index_column_opclass (Oid index_oid, int attno)
 
bool get_index_isreplident (Oid index_oid)
 
bool get_index_isvalid (Oid index_oid)
 
bool get_index_isclustered (Oid index_oid)
 
Oid get_publication_oid (const char *pubname, bool missing_ok)
 
charget_publication_name (Oid pubid, bool missing_ok)
 
Oid get_subscription_oid (const char *subname, bool missing_ok)
 
charget_subscription_name (Oid subid, bool missing_ok)
 
charget_propgraph_label_name (Oid labeloid)
 
charget_propgraph_property_name (Oid propoid)
 

Variables

PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook
 

Macro Definition Documentation

◆ ATTSTATSSLOT_NUMBERS

#define ATTSTATSSLOT_NUMBERS   0x02

Definition at line 44 of file lsyscache.h.

◆ ATTSTATSSLOT_VALUES

#define ATTSTATSSLOT_VALUES   0x01

Definition at line 43 of file lsyscache.h.

◆ type_is_array

#define type_is_array (   typid)    (get_element_type(typid) != InvalidOid)

Definition at line 219 of file lsyscache.h.

◆ type_is_array_domain

#define type_is_array_domain (   typid)    (get_base_element_type(typid) != InvalidOid)

Definition at line 221 of file lsyscache.h.

◆ TypeIsToastable

#define TypeIsToastable (   typid)    (get_typstorage(typid) != TYPSTORAGE_PLAIN)

Definition at line 223 of file lsyscache.h.

Typedef Documentation

◆ AttStatsSlot

◆ get_attavgwidth_hook_type

typedef int32(* get_attavgwidth_hook_type) (Oid relid, AttrNumber attnum)

Definition at line 66 of file lsyscache.h.

◆ IOFuncSelector

◆ OpIndexInterpretation

◆ SubscriptRoutines

Definition at line 22 of file lsyscache.h.

Enumeration Type Documentation

◆ IOFuncSelector

Enumerator
IOFunc_input 
IOFunc_output 
IOFunc_receive 
IOFunc_send 

Definition at line 34 of file lsyscache.h.

35{
IOFuncSelector
Definition lsyscache.h:35
@ IOFunc_output
Definition lsyscache.h:37
@ IOFunc_input
Definition lsyscache.h:36
@ IOFunc_send
Definition lsyscache.h:39
@ IOFunc_receive
Definition lsyscache.h:38

Function Documentation

◆ comparison_ops_are_compatible()

bool comparison_ops_are_compatible ( Oid  opno1,
Oid  opno2 
)
extern

Definition at line 825 of file lsyscache.c.

826{
827 bool result;
829 int i;
830
831 /* Easy if they're the same operator */
832 if (opno1 == opno2)
833 return true;
834
835 /*
836 * We search through all the pg_amop entries for opno1.
837 */
839
840 result = false;
841 for (i = 0; i < catlist->n_members; i++)
842 {
843 HeapTuple op_tuple = &catlist->members[i]->tuple;
845
846 /*
847 * op_in_opfamily() is cheaper than GetIndexAmRoutineByAmId(), so
848 * check it first
849 */
850 if (op_in_opfamily(opno2, op_form->amopfamily) &&
852 {
853 result = true;
854 break;
855 }
856 }
857
859
860 return result;
861}
const IndexAmRoutine * GetIndexAmRoutineByAmId(Oid amoid, bool noerror)
Definition amapi.c:69
uint32 result
static void * GETSTRUCT(const HeapTupleData *tuple)
int i
Definition isn.c:77
bool op_in_opfamily(Oid opno, Oid opfamily)
Definition lsyscache.c:70
END_CATALOG_STRUCT typedef FormData_pg_amop * Form_pg_amop
Definition pg_amop.h:92
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:252
static int fb(int x)
bool amconsistentordering
Definition amapi.h:254
#define ReleaseSysCacheList(x)
Definition syscache.h:134
#define SearchSysCacheList1(cacheId, key1)
Definition syscache.h:127

References IndexAmRoutine::amconsistentordering, fb(), Form_pg_amop, GetIndexAmRoutineByAmId(), GETSTRUCT(), i, ObjectIdGetDatum(), op_in_opfamily(), ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by ineq_histogram_selectivity().

◆ equality_ops_are_compatible()

bool equality_ops_are_compatible ( Oid  opno1,
Oid  opno2 
)
extern

Definition at line 773 of file lsyscache.c.

774{
775 bool result;
777 int i;
778
779 /* Easy if they're the same operator */
780 if (opno1 == opno2)
781 return true;
782
783 /*
784 * We search through all the pg_amop entries for opno1.
785 */
787
788 result = false;
789 for (i = 0; i < catlist->n_members; i++)
790 {
791 HeapTuple op_tuple = &catlist->members[i]->tuple;
793
794 /*
795 * op_in_opfamily() is cheaper than GetIndexAmRoutineByAmId(), so
796 * check it first
797 */
798 if (op_in_opfamily(opno2, op_form->amopfamily) &&
800 {
801 result = true;
802 break;
803 }
804 }
805
807
808 return result;
809}
bool amconsistentequality
Definition amapi.h:252

References IndexAmRoutine::amconsistentequality, fb(), Form_pg_amop, GetIndexAmRoutineByAmId(), GETSTRUCT(), i, ObjectIdGetDatum(), op_in_opfamily(), ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by query_is_distinct_for().

◆ free_attstatsslot()

void free_attstatsslot ( AttStatsSlot sslot)
extern

Definition at line 3539 of file lsyscache.c.

3540{
3541 /* The values[] array was separately palloc'd by deconstruct_array */
3542 if (sslot->values)
3543 pfree(sslot->values);
3544 /* The numbers[] array points into numbers_arr, do not pfree it */
3545 /* Free the detoasted array objects, if any */
3546 if (sslot->values_arr)
3547 pfree(sslot->values_arr);
3548 if (sslot->numbers_arr)
3549 pfree(sslot->numbers_arr);
3550}
void pfree(void *pointer)
Definition mcxt.c:1616

References fb(), and pfree().

Referenced by _int_matchsel(), booltestsel(), brincostestimate(), btcost_correlation(), calc_arraycontsel(), calc_hist_selectivity(), calc_hist_selectivity(), calc_multirangesel(), calc_rangesel(), eqjoinsel(), estimate_array_length(), estimate_hash_bucket_stats(), ExecHashBuildSkewHash(), get_variable_range(), histogram_selectivity(), ineq_histogram_selectivity(), mcv_selectivity(), networkjoinsel_inner(), networkjoinsel_semi(), networksel(), scalararraysel_containment(), tsquerysel(), var_eq_const(), and var_eq_non_const().

◆ func_parallel()

char func_parallel ( Oid  funcid)
extern

Definition at line 1992 of file lsyscache.c.

1993{
1994 HeapTuple tp;
1995 char result;
1996
1998 if (!HeapTupleIsValid(tp))
1999 elog(ERROR, "cache lookup failed for function %u", funcid);
2000
2002 ReleaseSysCache(tp);
2003 return result;
2004}
#define ERROR
Definition elog.h:40
#define elog(elevel,...)
Definition elog.h:228
#define HeapTupleIsValid(tuple)
Definition htup.h:78
END_CATALOG_STRUCT typedef FormData_pg_proc * Form_pg_proc
Definition pg_proc.h:140
void ReleaseSysCache(HeapTuple tuple)
Definition syscache.c:265
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Definition syscache.c:221

References elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by max_parallel_hazard_checker(), and set_rel_consider_parallel().

◆ func_strict()

◆ func_volatile()

◆ get_array_type()

◆ get_attavgwidth()

int32 get_attavgwidth ( Oid  relid,
AttrNumber  attnum 
)
extern

Definition at line 3353 of file lsyscache.c.

3354{
3355 HeapTuple tp;
3356 int32 stawidth;
3357
3359 {
3360 stawidth = (*get_attavgwidth_hook) (relid, attnum);
3361 if (stawidth > 0)
3362 return stawidth;
3363 }
3365 ObjectIdGetDatum(relid),
3367 BoolGetDatum(false));
3368 if (HeapTupleIsValid(tp))
3369 {
3370 stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth;
3371 ReleaseSysCache(tp);
3372 if (stawidth > 0)
3373 return stawidth;
3374 }
3375 return 0;
3376}
int32_t int32
Definition c.h:620
get_attavgwidth_hook_type get_attavgwidth_hook
Definition lsyscache.c:57
int16 attnum
FormData_pg_statistic * Form_pg_statistic
static Datum Int16GetDatum(int16 X)
Definition postgres.h:172
static Datum BoolGetDatum(bool X)
Definition postgres.h:112
HeapTuple SearchSysCache3(SysCacheIdentifier cacheId, Datum key1, Datum key2, Datum key3)
Definition syscache.c:241

References attnum, BoolGetDatum(), fb(), get_attavgwidth_hook, GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache3().

Referenced by get_rel_data_width(), and set_rel_width().

◆ get_attgenerated()

char get_attgenerated ( Oid  relid,
AttrNumber  attnum 
)
extern

Definition at line 1007 of file lsyscache.c.

1008{
1009 HeapTuple tp;
1011 char result;
1012
1014 ObjectIdGetDatum(relid),
1016 if (!HeapTupleIsValid(tp))
1017 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
1018 attnum, relid);
1020 result = att_tup->attgenerated;
1021 ReleaseSysCache(tp);
1022 return result;
1023}
FormData_pg_attribute * Form_pg_attribute
HeapTuple SearchSysCache2(SysCacheIdentifier cacheId, Datum key1, Datum key2)
Definition syscache.c:231

References attnum, elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache2().

Referenced by check_nested_generated_walker(), and CreateStatistics().

◆ get_attname()

char * get_attname ( Oid  relid,
AttrNumber  attnum,
bool  missing_ok 
)
extern

Definition at line 946 of file lsyscache.c.

947{
948 HeapTuple tp;
949
952 if (HeapTupleIsValid(tp))
953 {
955 char *result;
956
957 result = pstrdup(NameStr(att_tup->attname));
958 ReleaseSysCache(tp);
959 return result;
960 }
961
962 if (!missing_ok)
963 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
964 attnum, relid);
965 return NULL;
966}
#define NameStr(name)
Definition c.h:835
char * pstrdup(const char *in)
Definition mcxt.c:1781

References attnum, elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), result, and SearchSysCache2().

Referenced by AddRelationNewConstraints(), AddRelationNotNullConstraints(), AdjustNotNullInheritance(), ATExecAlterConstrInheritability(), attribute_statistics_update(), check_nested_generated_walker(), ComputePartitionAttrs(), contain_invalid_rfcolumn_walker(), CreateStatistics(), decompile_column_index_array(), deparseColumnRef(), DoCopy(), dropconstraint_internal(), errtablecol(), fixup_inherited_columns(), generateClonedExtStatsStmt(), generateClonedIndexStmt(), get_insert_query_def(), get_merge_query_def(), get_rte_attribute_name(), get_update_query_targetlist_def(), getIdentitySequence(), getObjectDescription(), getObjectIdentityParts(), make_propgraphdef_properties(), MergeConstraintsIntoExisting(), pg_get_constraintdef_worker(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_triggerdef_worker(), processIndirection(), pub_contains_invalid_column(), QueueNNConstraintValidation(), RelationGetNotNullConstraints(), RememberAllDependentForRebuilding(), transformPartitionBound(), and transformPartitionRangeBounds().

◆ get_attnum()

◆ get_attoptions()

Datum get_attoptions ( Oid  relid,
int16  attnum 
)
extern

Definition at line 1089 of file lsyscache.c.

1090{
1091 HeapTuple tuple;
1092 Datum attopts;
1093 Datum result;
1094 bool isnull;
1095
1096 tuple = SearchSysCache2(ATTNUM,
1097 ObjectIdGetDatum(relid),
1099
1100 if (!HeapTupleIsValid(tuple))
1101 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
1102 attnum, relid);
1103
1105 &isnull);
1106
1107 if (isnull)
1108 result = (Datum) 0;
1109 else
1110 result = datumCopy(attopts, false, -1); /* text[] */
1111
1112 ReleaseSysCache(tuple);
1113
1114 return result;
1115}
Datum datumCopy(Datum value, bool typByVal, int typLen)
Definition datum.c:132
uint64_t Datum
Definition postgres.h:70
Datum SysCacheGetAttr(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber, bool *isNull)
Definition syscache.c:596

References attnum, datumCopy(), elog, ERROR, fb(), HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), ReleaseSysCache(), result, SearchSysCache2(), and SysCacheGetAttr().

Referenced by CheckIndexCompatible(), generateClonedIndexStmt(), index_create_copy(), pg_get_indexdef_worker(), RelationGetIndexAttOptions(), and transformIndexConstraint().

◆ get_attstatsslot()

bool get_attstatsslot ( AttStatsSlot sslot,
HeapTuple  statstuple,
int  reqkind,
Oid  reqop,
int  flags 
)
extern

Definition at line 3429 of file lsyscache.c.

3431{
3433 int i;
3434 Datum val;
3437 int narrayelem;
3440
3441 /* initialize *sslot properly */
3442 memset(sslot, 0, sizeof(AttStatsSlot));
3443
3444 for (i = 0; i < STATISTIC_NUM_SLOTS; i++)
3445 {
3446 if ((&stats->stakind1)[i] == reqkind &&
3447 (reqop == InvalidOid || (&stats->staop1)[i] == reqop))
3448 break;
3449 }
3450 if (i >= STATISTIC_NUM_SLOTS)
3451 return false; /* not there */
3452
3453 sslot->staop = (&stats->staop1)[i];
3454 sslot->stacoll = (&stats->stacoll1)[i];
3455
3456 if (flags & ATTSTATSSLOT_VALUES)
3457 {
3460
3461 /*
3462 * Detoast the array if needed, and in any case make a copy that's
3463 * under control of this AttStatsSlot.
3464 */
3466
3467 /*
3468 * Extract the actual array element type, and pass it back in case the
3469 * caller needs it.
3470 */
3471 sslot->valuetype = arrayelemtype = ARR_ELEMTYPE(statarray);
3472
3473 /* Need info about element type */
3476 elog(ERROR, "cache lookup failed for type %u", arrayelemtype);
3478
3479 /* Deconstruct array into Datum elements; NULLs not expected */
3482 typeForm->typlen,
3483 typeForm->typbyval,
3484 typeForm->typalign,
3485 &sslot->values, NULL, &sslot->nvalues);
3486
3487 /*
3488 * If the element type is pass-by-reference, we now have a bunch of
3489 * Datums that are pointers into the statarray, so we need to keep
3490 * that until free_attstatsslot. Otherwise, all the useful info is in
3491 * sslot->values[], so we can free the array object immediately.
3492 */
3493 if (!typeForm->typbyval)
3494 sslot->values_arr = statarray;
3495 else
3497
3499 }
3500
3501 if (flags & ATTSTATSSLOT_NUMBERS)
3502 {
3505
3506 /*
3507 * Detoast the array if needed, and in any case make a copy that's
3508 * under control of this AttStatsSlot.
3509 */
3511
3512 /*
3513 * We expect the array to be a 1-D float4 array; verify that. We don't
3514 * need to use deconstruct_array() since the array data is just going
3515 * to look like a C array of float4 values.
3516 */
3518 if (ARR_NDIM(statarray) != 1 || narrayelem <= 0 ||
3521 elog(ERROR, "stanumbers is not a 1-D float4 array");
3522
3523 /* Give caller a pointer directly into the statarray */
3524 sslot->numbers = (float4 *) ARR_DATA_PTR(statarray);
3525 sslot->nnumbers = narrayelem;
3526
3527 /* We'll free the statarray in free_attstatsslot */
3528 sslot->numbers_arr = statarray;
3529 }
3530
3531 return true;
3532}
#define DatumGetArrayTypePCopy(X)
Definition array.h:262
#define ARR_NDIM(a)
Definition array.h:290
#define ARR_DATA_PTR(a)
Definition array.h:322
#define ARR_ELEMTYPE(a)
Definition array.h:292
#define ARR_DIMS(a)
Definition array.h:294
#define ARR_HASNULL(a)
Definition array.h:291
void deconstruct_array(const ArrayType *array, Oid elmtype, int elmlen, bool elmbyval, char elmalign, Datum **elemsp, bool **nullsp, int *nelemsp)
float float4
Definition c.h:713
long val
Definition informix.c:689
#define ATTSTATSSLOT_NUMBERS
Definition lsyscache.h:44
#define ATTSTATSSLOT_VALUES
Definition lsyscache.h:43
#define STATISTIC_NUM_SLOTS
Datum SysCacheGetAttrNotNull(SysCacheIdentifier cacheId, HeapTuple tup, AttrNumber attributeNumber)
Definition syscache.c:626

References ARR_DATA_PTR, ARR_DIMS, ARR_ELEMTYPE, ARR_HASNULL, ARR_NDIM, ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, DatumGetArrayTypePCopy, deconstruct_array(), elog, ERROR, fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, i, InvalidOid, ObjectIdGetDatum(), pfree(), ReleaseSysCache(), SearchSysCache1(), STATISTIC_NUM_SLOTS, SysCacheGetAttrNotNull(), and val.

Referenced by _int_matchsel(), booltestsel(), brincostestimate(), btcost_correlation(), calc_arraycontsel(), calc_hist_selectivity(), calc_hist_selectivity(), calc_multirangesel(), calc_rangesel(), eqjoinsel(), estimate_array_length(), estimate_hash_bucket_stats(), ExecHashBuildSkewHash(), get_variable_range(), histogram_selectivity(), ineq_histogram_selectivity(), mcv_selectivity(), networkjoinsel_inner(), networkjoinsel_semi(), networksel(), scalararraysel_containment(), tsquerysel(), var_eq_const(), and var_eq_non_const().

◆ get_atttype()

Oid get_atttype ( Oid  relid,
AttrNumber  attnum 
)
extern

Definition at line 1032 of file lsyscache.c.

1033{
1034 HeapTuple tp;
1035
1037 ObjectIdGetDatum(relid),
1039 if (HeapTupleIsValid(tp))
1040 {
1042 Oid result;
1043
1044 result = att_tup->atttypid;
1045 ReleaseSysCache(tp);
1046 return result;
1047 }
1048 else
1049 return InvalidOid;
1050}

References attnum, fb(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache2().

Referenced by generateClonedIndexStmt(), GetIndexInputType(), LookupTypeNameExtended(), and transformAlterTableStmt().

◆ get_atttypetypmodcoll()

void get_atttypetypmodcoll ( Oid  relid,
AttrNumber  attnum,
Oid typid,
int32 typmod,
Oid collid 
)
extern

Definition at line 1062 of file lsyscache.c.

1064{
1065 HeapTuple tp;
1067
1069 ObjectIdGetDatum(relid),
1071 if (!HeapTupleIsValid(tp))
1072 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
1073 attnum, relid);
1075
1076 *typid = att_tup->atttypid;
1077 *typmod = att_tup->atttypmod;
1078 *collid = att_tup->attcollation;
1079 ReleaseSysCache(tp);
1080}
Oid collid

References attnum, collid, elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache2().

Referenced by build_edge_vertex_link_quals(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), propgraph_edge_get_ref_keys(), and transformAssignmentIndirection().

◆ get_base_element_type()

Oid get_base_element_type ( Oid  typid)
extern

Definition at line 3027 of file lsyscache.c.

3028{
3029 /*
3030 * We loop to find the bottom base type in a stack of domains.
3031 */
3032 for (;;)
3033 {
3034 HeapTuple tup;
3036
3038 if (!HeapTupleIsValid(tup))
3039 break;
3041 if (typTup->typtype != TYPTYPE_DOMAIN)
3042 {
3043 /* Not a domain, so stop descending */
3044 Oid result;
3045
3046 /* This test must match get_element_type */
3048 result = typTup->typelem;
3049 else
3052 return result;
3053 }
3054
3055 typid = typTup->typbasetype;
3057 }
3058
3059 /* Like get_element_type, silently return InvalidOid for bogus input */
3060 return InvalidOid;
3061}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by array_typanalyze(), arraycontsel(), build_datatype(), cache_array_element_properties(), concat_internal(), ConstructTupleDescriptor(), count_nulls(), CreateFunction(), get_call_expr_argtype(), get_rule_expr(), make_scalar_array_op(), ParseFuncOrColumn(), plperl_hash_from_tuple(), scalararraysel(), statatt_get_elem_type(), and text_format().

◆ get_cast_oid()

Oid get_cast_oid ( Oid  sourcetypeid,
Oid  targettypeid,
bool  missing_ok 
)
extern

Definition at line 1126 of file lsyscache.c.

1127{
1128 Oid oid;
1129
1133 if (!OidIsValid(oid) && !missing_ok)
1134 ereport(ERROR,
1136 errmsg("cast from type %s to type %s does not exist",
1139 return oid;
1140}
#define OidIsValid(objectId)
Definition c.h:858
int errcode(int sqlerrcode)
Definition elog.c:875
#define ereport(elevel,...)
Definition elog.h:152
char * format_type_be(Oid type_oid)
static char * errmsg
#define GetSysCacheOid2(cacheId, oidcol, key1, key2)
Definition syscache.h:111

References ereport, errcode(), errmsg, ERROR, fb(), format_type_be(), GetSysCacheOid2, ObjectIdGetDatum(), and OidIsValid.

Referenced by get_object_address().

◆ get_collation_isdeterministic()

bool get_collation_isdeterministic ( Oid  colloid)
extern

Definition at line 1173 of file lsyscache.c.

1174{
1175 HeapTuple tp;
1177 bool result;
1178
1180 if (!HeapTupleIsValid(tp))
1181 elog(ERROR, "cache lookup failed for collation %u", colloid);
1183 result = colltup->collisdeterministic;
1184 ReleaseSysCache(tp);
1185 return result;
1186}
END_CATALOG_STRUCT typedef FormData_pg_collation * Form_pg_collation

References elog, ERROR, fb(), Form_pg_collation, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by ATAddForeignKeyConstraint(), having_collation_conflict_walker(), index_create(), and match_pattern_prefix().

◆ get_collation_name()

◆ get_commutator()

◆ get_compatible_hash_operators()

bool get_compatible_hash_operators ( Oid  opno,
Oid lhs_opno,
Oid rhs_opno 
)
extern

Definition at line 477 of file lsyscache.c.

479{
480 bool result = false;
482 int i;
483
484 /* Ensure output args are initialized on failure */
485 if (lhs_opno)
487 if (rhs_opno)
489
490 /*
491 * Search pg_amop to see if the target operator is registered as the "="
492 * operator of any hash opfamily. If the operator is registered in
493 * multiple opfamilies, assume we can use any one.
494 */
496
497 for (i = 0; i < catlist->n_members; i++)
498 {
499 HeapTuple tuple = &catlist->members[i]->tuple;
501
502 if (aform->amopmethod == HASH_AM_OID &&
503 aform->amopstrategy == HTEqualStrategyNumber)
504 {
505 /* No extra lookup needed if given operator is single-type */
506 if (aform->amoplefttype == aform->amoprighttype)
507 {
508 if (lhs_opno)
509 *lhs_opno = opno;
510 if (rhs_opno)
511 *rhs_opno = opno;
512 result = true;
513 break;
514 }
515
516 /*
517 * Get the matching single-type operator(s). Failure probably
518 * shouldn't happen --- it implies a bogus opfamily --- but
519 * continue looking if so.
520 */
521 if (lhs_opno)
522 {
523 *lhs_opno = get_opfamily_member(aform->amopfamily,
524 aform->amoplefttype,
525 aform->amoplefttype,
527 if (!OidIsValid(*lhs_opno))
528 continue;
529 /* Matching LHS found, done if caller doesn't want RHS */
530 if (!rhs_opno)
531 {
532 result = true;
533 break;
534 }
535 }
536 if (rhs_opno)
537 {
538 *rhs_opno = get_opfamily_member(aform->amopfamily,
539 aform->amoprighttype,
540 aform->amoprighttype,
542 if (!OidIsValid(*rhs_opno))
543 {
544 /* Forget any LHS operator from this opfamily */
545 if (lhs_opno)
547 continue;
548 }
549 /* Matching RHS found, so done */
550 result = true;
551 break;
552 }
553 }
554 }
555
557
558 return result;
559}
Oid get_opfamily_member(Oid opfamily, Oid lefttype, Oid righttype, int16 strategy)
Definition lsyscache.c:170
#define HTEqualStrategyNumber
Definition stratnum.h:41

References fb(), Form_pg_amop, get_opfamily_member(), GETSTRUCT(), HTEqualStrategyNumber, i, InvalidOid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by create_unique_paths(), and ExecInitSubPlan().

◆ get_constraint_index()

Oid get_constraint_index ( Oid  conoid)
extern

Definition at line 1232 of file lsyscache.c.

1233{
1234 HeapTuple tp;
1235
1237 if (HeapTupleIsValid(tp))
1238 {
1240 Oid result;
1241
1242 if (contup->contype == CONSTRAINT_UNIQUE ||
1243 contup->contype == CONSTRAINT_PRIMARY ||
1244 contup->contype == CONSTRAINT_EXCLUSION)
1245 result = contup->conindid;
1246 else
1248 ReleaseSysCache(tp);
1249 return result;
1250 }
1251 else
1252 return InvalidOid;
1253}
END_CATALOG_STRUCT typedef FormData_pg_constraint * Form_pg_constraint

References fb(), Form_pg_constraint, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by ATPostAlterTypeParse(), infer_arbiter_indexes(), and RememberConstraintForRebuilding().

◆ get_constraint_name()

char * get_constraint_name ( Oid  conoid)
extern

Definition at line 1200 of file lsyscache.c.

1201{
1202 HeapTuple tp;
1203
1205 if (HeapTupleIsValid(tp))
1206 {
1208 char *result;
1209
1210 result = pstrdup(NameStr(contup->conname));
1211 ReleaseSysCache(tp);
1212 return result;
1213 }
1214 else
1215 return NULL;
1216}

References fb(), Form_pg_constraint, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by addFkRecurseReferencing(), CloneFkReferencing(), get_insert_query_def(), and report_triggers().

◆ get_constraint_type()

char get_constraint_type ( Oid  conoid)
extern

Definition at line 1262 of file lsyscache.c.

1263{
1264 HeapTuple tp;
1265 char contype;
1266
1268 if (!HeapTupleIsValid(tp))
1269 elog(ERROR, "cache lookup failed for constraint %u", conoid);
1270
1271 contype = ((Form_pg_constraint) GETSTRUCT(tp))->contype;
1272 ReleaseSysCache(tp);
1273
1274 return contype;
1275}

References elog, ERROR, fb(), Form_pg_constraint, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by AttachPartitionEnsureIndexes(), and RememberConstraintForRebuilding().

◆ get_database_name()

char * get_database_name ( Oid  dbid)
extern

Definition at line 1285 of file lsyscache.c.

1286{
1288 char *result;
1289
1292 {
1295 }
1296 else
1297 result = NULL;
1298
1299 return result;
1300}
NameData datname
Definition pg_database.h:37
END_CATALOG_STRUCT typedef FormData_pg_database * Form_pg_database

References datname, fb(), Form_pg_database, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by AfterTriggerSetState(), AlterObjectRename_internal(), AlterPublicationOwner_internal(), AlterSchemaOwner_internal(), AlterSubscriptionOwner_internal(), calculate_database_size(), createdb(), CreatePublication(), CreateSchemaCommand(), CreateSubscription(), current_database(), database_to_xml_internal(), DeconstructQualifiedName(), do_analyze_rel(), do_autovacuum(), exec_object_restorecon(), ExpandColumnRefStar(), GetNewMultiXactId(), GetNewTransactionId(), getObjectDescription(), getObjectIdentityParts(), heap_vacuum_rel(), IdentifySystem(), InitTempTableNamespace(), map_sql_catalog_to_xmlschema_types(), map_sql_schema_to_xmlschema_types(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), perform_work_item(), pg_get_database_ddl_internal(), pg_get_role_ddl_internal(), RangeVarGetAndCheckCreationNamespace(), RangeVarGetCreationNamespace(), RangeVarGetRelidExtended(), regdatabaseout(), ReindexMultipleTables(), RenameSchema(), SetMultiXactIdLimit(), SetTransactionIdLimit(), shdepLockAndCheckObject(), TerminateOtherDBBackends(), and transformColumnRef().

◆ get_element_type()

◆ get_equality_op_for_ordering_op()

Oid get_equality_op_for_ordering_op ( Oid  opno,
bool reverse 
)
extern

Definition at line 326 of file lsyscache.c.

327{
329 Oid opfamily;
330 Oid opcintype;
331 CompareType cmptype;
332
333 /* Find the operator in pg_amop */
335 &opfamily, &opcintype, &cmptype))
336 {
337 /* Found a suitable opfamily, get matching equality operator */
339 opcintype,
340 opcintype,
341 COMPARE_EQ);
342 if (reverse)
343 *reverse = (cmptype == COMPARE_GT);
344 }
345
346 return result;
347}
CompareType
Definition cmptype.h:32
@ COMPARE_GT
Definition cmptype.h:38
@ COMPARE_EQ
Definition cmptype.h:36
bool get_ordering_op_properties(Oid opno, Oid *opfamily, Oid *opcintype, CompareType *cmptype)
Definition lsyscache.c:261
Oid get_opfamily_member_for_cmptype(Oid opfamily, Oid lefttype, Oid righttype, CompareType cmptype)
Definition lsyscache.c:199

References COMPARE_EQ, COMPARE_GT, get_opfamily_member_for_cmptype(), get_ordering_op_properties(), InvalidOid, and result.

Referenced by addTargetToSortList(), create_unique_paths(), preparePresortedCols(), preprocess_minmax_aggregates(), and show_sortorder_options().

◆ get_func_leakproof()

bool get_func_leakproof ( Oid  funcid)
extern

◆ get_func_name()

◆ get_func_namespace()

Oid get_func_namespace ( Oid  funcid)
extern

Definition at line 1825 of file lsyscache.c.

1826{
1827 HeapTuple tp;
1828
1830 if (HeapTupleIsValid(tp))
1831 {
1833 Oid result;
1834
1835 result = functup->pronamespace;
1836 ReleaseSysCache(tp);
1837 return result;
1838 }
1839 else
1840 return InvalidOid;
1841}

References fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by ExplainTargetRel(), sepgsql_proc_drop(), and unaccent_dict().

◆ get_func_nargs()

int get_func_nargs ( Oid  funcid)
extern

Definition at line 1867 of file lsyscache.c.

1868{
1869 HeapTuple tp;
1870 int result;
1871
1873 if (!HeapTupleIsValid(tp))
1874 elog(ERROR, "cache lookup failed for function %u", funcid);
1875
1877 ReleaseSysCache(tp);
1878 return result;
1879}
int16 pronargs
Definition pg_proc.h:83

References elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), pronargs, ReleaseSysCache(), result, and SearchSysCache1().

◆ get_func_prokind()

char get_func_prokind ( Oid  funcid)
extern

Definition at line 2011 of file lsyscache.c.

2012{
2013 HeapTuple tp;
2014 char result;
2015
2017 if (!HeapTupleIsValid(tp))
2018 elog(ERROR, "cache lookup failed for function %u", funcid);
2019
2020 result = ((Form_pg_proc) GETSTRUCT(tp))->prokind;
2021 ReleaseSysCache(tp);
2022 return result;
2023}

References elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by LookupFuncNameInternal(), LookupFuncWithArgs(), and RemoveObjects().

◆ get_func_retset()

bool get_func_retset ( Oid  funcid)
extern

Definition at line 1935 of file lsyscache.c.

1936{
1937 HeapTuple tp;
1938 bool result;
1939
1941 if (!HeapTupleIsValid(tp))
1942 elog(ERROR, "cache lookup failed for function %u", funcid);
1943
1945 ReleaseSysCache(tp);
1946 return result;
1947}

References elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by build_edge_vertex_link_quals(), make_op(), and make_scalar_array_op().

◆ get_func_rettype()

◆ get_func_signature()

Oid get_func_signature ( Oid  funcid,
Oid **  argtypes,
int nargs 
)
extern

Definition at line 1889 of file lsyscache.c.

1890{
1891 HeapTuple tp;
1893 Oid result;
1894
1896 if (!HeapTupleIsValid(tp))
1897 elog(ERROR, "cache lookup failed for function %u", funcid);
1898
1900
1901 result = procstruct->prorettype;
1902 *nargs = (int) procstruct->pronargs;
1903 Assert(*nargs == procstruct->proargtypes.dim1);
1904 *argtypes = (Oid *) palloc(*nargs * sizeof(Oid));
1905 memcpy(*argtypes, procstruct->proargtypes.values, *nargs * sizeof(Oid));
1906
1907 ReleaseSysCache(tp);
1908 return result;
1909}
#define Assert(condition)
Definition c.h:943
memcpy(sums, checksumBaseOffsets, sizeof(checksumBaseOffsets))
void * palloc(Size size)
Definition mcxt.c:1387

References Assert, elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, memcpy(), ObjectIdGetDatum(), palloc(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by plperl_call_perl_func(), resolve_aggregate_transtype(), and typeDepNeeded().

◆ get_func_support()

RegProcedure get_func_support ( Oid  funcid)
extern

◆ get_func_variadictype()

Oid get_func_variadictype ( Oid  funcid)
extern

Definition at line 1916 of file lsyscache.c.

1917{
1918 HeapTuple tp;
1919 Oid result;
1920
1922 if (!HeapTupleIsValid(tp))
1923 elog(ERROR, "cache lookup failed for function %u", funcid);
1924
1926 ReleaseSysCache(tp);
1927 return result;
1928}

References elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by assign_hypothetical_collations(), and assign_ordered_set_collations().

◆ get_index_column_opclass()

Oid get_index_column_opclass ( Oid  index_oid,
int  attno 
)
extern

Definition at line 3732 of file lsyscache.c.

3733{
3734 HeapTuple tuple;
3735 Form_pg_index rd_index;
3736 Datum datum;
3738 Oid opclass;
3739
3740 /* First we need to know the column's opclass. */
3741
3743 if (!HeapTupleIsValid(tuple))
3744 return InvalidOid;
3745
3746 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3747
3748 /* caller is supposed to guarantee this */
3749 Assert(attno > 0 && attno <= rd_index->indnatts);
3750
3751 /* Non-key attributes don't have an opclass */
3752 if (attno > rd_index->indnkeyatts)
3753 {
3754 ReleaseSysCache(tuple);
3755 return InvalidOid;
3756 }
3757
3759 indclass = ((oidvector *) DatumGetPointer(datum));
3760
3762 opclass = indclass->values[attno - 1];
3763
3764 ReleaseSysCache(tuple);
3765
3766 return opclass;
3767}
END_CATALOG_STRUCT typedef FormData_pg_index * Form_pg_index
Definition pg_index.h:74
static Pointer DatumGetPointer(Datum X)
Definition postgres.h:332
Definition c.h:815

References Assert, DatumGetPointer(), fb(), Form_pg_index, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache1(), and SysCacheGetAttrNotNull().

Referenced by gistproperty(), ri_LoadConstraintInfo(), and spgproperty().

◆ get_index_isclustered()

bool get_index_isclustered ( Oid  index_oid)
extern

Definition at line 3821 of file lsyscache.c.

3822{
3823 bool isclustered;
3824 HeapTuple tuple;
3825 Form_pg_index rd_index;
3826
3828 if (!HeapTupleIsValid(tuple))
3829 elog(ERROR, "cache lookup failed for index %u", index_oid);
3830
3831 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3832 isclustered = rd_index->indisclustered;
3833 ReleaseSysCache(tuple);
3834
3835 return isclustered;
3836}

References elog, ERROR, fb(), Form_pg_index, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by cluster_rel_recheck(), determine_clustered_index(), mark_index_clustered(), and RememberClusterOnForRebuilding().

◆ get_index_isreplident()

bool get_index_isreplident ( Oid  index_oid)
extern

Definition at line 3775 of file lsyscache.c.

3776{
3777 HeapTuple tuple;
3778 Form_pg_index rd_index;
3779 bool result;
3780
3782 if (!HeapTupleIsValid(tuple))
3783 return false;
3784
3785 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3786 result = rd_index->indisreplident;
3787 ReleaseSysCache(tuple);
3788
3789 return result;
3790}

References fb(), Form_pg_index, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by RememberReplicaIdentityForRebuilding().

◆ get_index_isvalid()

bool get_index_isvalid ( Oid  index_oid)
extern

Definition at line 3798 of file lsyscache.c.

3799{
3800 bool isvalid;
3801 HeapTuple tuple;
3802 Form_pg_index rd_index;
3803
3805 if (!HeapTupleIsValid(tuple))
3806 elog(ERROR, "cache lookup failed for index %u", index_oid);
3807
3808 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3809 isvalid = rd_index->indisvalid;
3810 ReleaseSysCache(tuple);
3811
3812 return isvalid;
3813}

References elog, ERROR, fb(), Form_pg_index, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by DefineIndex(), reindex_index(), reindex_relation(), and ReindexRelationConcurrently().

◆ get_language_name()

char * get_language_name ( Oid  langoid,
bool  missing_ok 
)
extern

Definition at line 1306 of file lsyscache.c.

1307{
1308 HeapTuple tp;
1309
1311 if (HeapTupleIsValid(tp))
1312 {
1314 char *result;
1315
1316 result = pstrdup(NameStr(lantup->lanname));
1317 ReleaseSysCache(tp);
1318 return result;
1319 }
1320
1321 if (!missing_ok)
1322 elog(ERROR, "cache lookup failed for language %u",
1323 langoid);
1324 return NULL;
1325}
END_CATALOG_STRUCT typedef FormData_pg_language * Form_pg_language
Definition pg_language.h:69

References elog, ERROR, fb(), Form_pg_language, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by get_transform_oid(), getObjectDescription(), getObjectIdentityParts(), and pg_get_functiondef().

◆ get_mergejoin_opfamilies()

List * get_mergejoin_opfamilies ( Oid  opno)
extern

Definition at line 430 of file lsyscache.c.

431{
432 List *result = NIL;
434 int i;
435
436 /*
437 * Search pg_amop to see if the target operator is registered as the "="
438 * operator of any opfamily of an ordering index type.
439 */
441
442 for (i = 0; i < catlist->n_members; i++)
443 {
444 HeapTuple tuple = &catlist->members[i]->tuple;
446
447 /* must be ordering index equality */
448 if (get_opmethod_canorder(aform->amopmethod) &&
449 IndexAmTranslateStrategy(aform->amopstrategy,
450 aform->amopmethod,
451 aform->amopfamily,
452 true) == COMPARE_EQ)
453 result = lappend_oid(result, aform->amopfamily);
454 }
455
457
458 return result;
459}
CompareType IndexAmTranslateStrategy(StrategyNumber strategy, Oid amoid, Oid opfamily, bool missing_ok)
Definition amapi.c:131
List * lappend_oid(List *list, Oid datum)
Definition list.c:375
static bool get_opmethod_canorder(Oid amoid)
Definition lsyscache.c:223
#define NIL
Definition pg_list.h:68
Definition pg_list.h:54

References COMPARE_EQ, fb(), Form_pg_amop, get_opmethod_canorder(), GETSTRUCT(), i, IndexAmTranslateStrategy(), lappend_oid(), NIL, ObjectIdGetDatum(), ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by check_mergejoinable(), compute_semijoin_info(), get_eclass_for_sortgroupclause(), have_partkey_equi_join(), make_pathkey_from_sortinfo(), and match_eclasses_to_foreign_key_col().

◆ get_multirange_range()

◆ get_namespace_name()

char * get_namespace_name ( Oid  nspid)
extern

Definition at line 3561 of file lsyscache.c.

3562{
3563 HeapTuple tp;
3564
3566 if (HeapTupleIsValid(tp))
3567 {
3569 char *result;
3570
3571 result = pstrdup(NameStr(nsptup->nspname));
3572 ReleaseSysCache(tp);
3573 return result;
3574 }
3575 else
3576 return NULL;
3577}
int nspid
END_CATALOG_STRUCT typedef FormData_pg_namespace * Form_pg_namespace

References fb(), Form_pg_namespace, GETSTRUCT(), HeapTupleIsValid, NameStr, nspid, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by acquire_inherited_sample_rows(), AlterExtensionNamespace(), AlterObjectNamespace_internal(), AlterObjectOwner_internal(), AlterObjectRename_internal(), AlterRelationNamespaceInternal(), AlterSubscription_refresh(), AlterSubscription_refresh_seq(), AlterTableMoveAll(), AlterTypeNamespaceInternal(), AlterTypeOwner(), appendFunctionName(), apply_handle_tuple_routing(), ApplyExtensionUpdates(), ATExecChangeOwner(), ATParseTransformCmd(), BuildRelationExtStatistics(), check_and_init_gencol(), check_default_text_search_config(), check_publication_add_schema(), check_publications_origin_sequences(), check_publications_origin_tables(), CheckPubRelationColumnList(), compute_return_type(), copy_table(), copy_table_data(), create_pg_locale(), CreateConversionCommand(), CreateExtensionInternal(), CreateFunction(), CreateStatistics(), current_schema(), current_schemas(), currtid_internal(), DefineAggregate(), DefineCollation(), DefineDomain(), DefineEnum(), DefineIndex(), DefineOpClass(), DefineOperator(), DefineOpFamily(), DefineRange(), DefineTSConfiguration(), DefineTSDictionary(), DefineType(), deparseOperatorName(), deparseRelation(), do_analyze_rel(), do_autovacuum(), DoCopy(), errdatatype(), errtable(), EventTriggerSQLDropAddObject(), exec_object_restorecon(), ExecAlterExtensionContentsRecurse(), ExecBRInsertTriggers(), execute_extension_script(), fetch_statentries_for_relation(), format_operator_extended(), format_procedure_extended(), generate_operator_clause(), generate_relation_name(), generateClonedIndexStmt(), generateSerialExtraStmts(), get_and_validate_seq_info(), get_collation(), get_namespace_name_or_temp(), get_opclass(), get_other_operator(), getObjectDescription(), getOpFamilyDescription(), getPublicationSchemaInfo(), getRelationDescription(), GetTempNamespaceProcNumber(), HandleFunctionRequest(), heap_create(), heap_vacuum_rel(), isAnyTempNamespace(), IsThereCollationInNamespace(), IsThereFunctionInNamespace(), IsThereOpClassInNamespace(), IsThereOpFamilyInNamespace(), logicalrep_write_namespace(), LogicalRepSyncSequences(), map_sql_catalog_to_xmlschema_types(), map_sql_schema_to_xmlschema_types(), map_sql_table_to_xmlschema(), map_sql_type_to_xml_name(), MarkInheritDetached(), obtain_object_name_namespace(), parallel_vacuum_main(), perform_work_item(), pg_clear_extended_stats(), pg_decode_change(), pg_decode_truncate(), pg_get_propgraphdef(), pg_identify_object(), pgoutput_column_list_init(), pgoutput_row_filter(), plpgsql_fulfill_promise(), postgresImportForeignStatistics(), ProcessSingleRelationFork(), publication_add_schema(), PublicationDropSchemas(), quoteRelationName(), RangeVarCallbackForAlterRelation(), RangeVarGetAndCheckCreationNamespace(), RebuildConstraintComment(), refresh_by_match_merge(), RefreshMatViewByOid(), regclassout(), regcollationout(), regconfigout(), regdictionaryout(), regnamespaceout(), regoperout(), regprocout(), reindex_index(), reindex_relation(), ReindexMultipleInternal(), ReindexPartitions(), ReindexRelationConcurrently(), report_namespace_conflict(), ReportApplyConflict(), ri_CheckPermissions(), ri_GenerateQualCollation(), schema_to_xml_internal(), sepgsql_proc_post_create(), sepgsql_relation_post_create(), SPI_getnspname(), swap_relation_files(), transformAlterTableStmt(), transformCreateStmt(), and unaccent_dict().

◆ get_namespace_name_or_temp()

◆ get_negator()

◆ get_op_hash_functions()

bool get_op_hash_functions ( Oid  opno,
RegProcedure lhs_procno,
RegProcedure rhs_procno 
)
extern

Definition at line 577 of file lsyscache.c.

579{
580 bool result = false;
582 int i;
583
584 /* Ensure output args are initialized on failure */
585 if (lhs_procno)
587 if (rhs_procno)
589
590 /*
591 * Search pg_amop to see if the target operator is registered as the "="
592 * operator of any hash opfamily. If the operator is registered in
593 * multiple opfamilies, assume we can use any one.
594 */
596
597 for (i = 0; i < catlist->n_members; i++)
598 {
599 HeapTuple tuple = &catlist->members[i]->tuple;
601
602 if (aform->amopmethod == HASH_AM_OID &&
603 aform->amopstrategy == HTEqualStrategyNumber)
604 {
605 /*
606 * Get the matching support function(s). Failure probably
607 * shouldn't happen --- it implies a bogus opfamily --- but
608 * continue looking if so.
609 */
610 if (lhs_procno)
611 {
612 *lhs_procno = get_opfamily_proc(aform->amopfamily,
613 aform->amoplefttype,
614 aform->amoplefttype,
616 if (!OidIsValid(*lhs_procno))
617 continue;
618 /* Matching LHS found, done if caller doesn't want RHS */
619 if (!rhs_procno)
620 {
621 result = true;
622 break;
623 }
624 /* Only one lookup needed if given operator is single-type */
625 if (aform->amoplefttype == aform->amoprighttype)
626 {
628 result = true;
629 break;
630 }
631 }
632 if (rhs_procno)
633 {
634 *rhs_procno = get_opfamily_proc(aform->amopfamily,
635 aform->amoprighttype,
636 aform->amoprighttype,
638 if (!OidIsValid(*rhs_procno))
639 {
640 /* Forget any LHS function from this opfamily */
641 if (lhs_procno)
643 continue;
644 }
645 /* Matching RHS found, so done */
646 result = true;
647 break;
648 }
649 }
650 }
651
653
654 return result;
655}
#define HASHSTANDARD_PROC
Definition hash.h:355
Oid get_opfamily_proc(Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
Definition lsyscache.c:915

References fb(), Form_pg_amop, get_opfamily_proc(), GETSTRUCT(), HASHSTANDARD_PROC, HTEqualStrategyNumber, i, InvalidOid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by convert_saop_to_hashed_saop_walker(), eqjoinsel(), ExecInitHashJoin(), ExecInitMemoize(), ExecInitSubPlan(), and execTuplesHashPrepare().

◆ get_op_index_interpretation()

List * get_op_index_interpretation ( Oid  opno)
extern

Definition at line 668 of file lsyscache.c.

669{
670 List *result = NIL;
673 int i;
674
675 /*
676 * Find all the pg_amop entries containing the operator.
677 */
679
680 for (i = 0; i < catlist->n_members; i++)
681 {
682 HeapTuple op_tuple = &catlist->members[i]->tuple;
684 CompareType cmptype;
685
686 /* must be ordering index */
687 if (!get_opmethod_canorder(op_form->amopmethod))
688 continue;
689
690 /* Get the operator's comparison type */
691 cmptype = IndexAmTranslateStrategy(op_form->amopstrategy,
692 op_form->amopmethod,
693 op_form->amopfamily,
694 true);
695
696 /* should not happen */
697 if (cmptype == COMPARE_INVALID)
698 continue;
699
701 thisresult->opfamily_id = op_form->amopfamily;
702 thisresult->cmptype = cmptype;
703 thisresult->oplefttype = op_form->amoplefttype;
704 thisresult->oprighttype = op_form->amoprighttype;
706 }
707
709
710 /*
711 * If we didn't find any btree opfamily containing the operator, perhaps
712 * it is a <> operator. See if it has a negator that is in an opfamily.
713 */
714 if (result == NIL)
715 {
716 Oid op_negator = get_negator(opno);
717
719 {
722
723 for (i = 0; i < catlist->n_members; i++)
724 {
725 HeapTuple op_tuple = &catlist->members[i]->tuple;
727 const IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(op_form->amopmethod, false);
728 CompareType cmptype;
729
730 /* must be ordering index */
731 if (!amroutine->amcanorder)
732 continue;
733
734 /* Get the operator's comparison type */
735 cmptype = IndexAmTranslateStrategy(op_form->amopstrategy,
736 op_form->amopmethod,
737 op_form->amopfamily,
738 true);
739
740 /* Only consider negators that are = */
741 if (cmptype != COMPARE_EQ)
742 continue;
743
744 /* OK, report it as COMPARE_NE */
746 thisresult->opfamily_id = op_form->amopfamily;
747 thisresult->cmptype = COMPARE_NE;
748 thisresult->oplefttype = op_form->amoplefttype;
749 thisresult->oprighttype = op_form->amoprighttype;
751 }
752
754 }
755 }
756
757 return result;
758}
@ COMPARE_INVALID
Definition cmptype.h:33
@ COMPARE_NE
Definition cmptype.h:39
#define palloc_object(type)
Definition fe_memutils.h:74
List * lappend(List *list, void *datum)
Definition list.c:339
Oid get_negator(Oid opno)
Definition lsyscache.c:1726

References COMPARE_EQ, COMPARE_INVALID, COMPARE_NE, fb(), Form_pg_amop, get_negator(), get_opmethod_canorder(), GetIndexAmRoutineByAmId(), GETSTRUCT(), i, IndexAmTranslateStrategy(), lappend(), NIL, ObjectIdGetDatum(), OidIsValid, palloc_object, ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by find_window_run_conditions(), lookup_proof_cache(), and make_row_comparison_op().

◆ get_op_opfamily_properties()

void get_op_opfamily_properties ( Oid  opno,
Oid  opfamily,
bool  ordering_op,
int strategy,
Oid lefttype,
Oid righttype 
)
extern

Definition at line 140 of file lsyscache.c.

144{
145 HeapTuple tp;
147
149 ObjectIdGetDatum(opno),
151 ObjectIdGetDatum(opfamily));
152 if (!HeapTupleIsValid(tp))
153 elog(ERROR, "operator %u is not a member of opfamily %u",
154 opno, opfamily);
156 *strategy = amop_tup->amopstrategy;
157 *lefttype = amop_tup->amoplefttype;
158 *righttype = amop_tup->amoprighttype;
159 ReleaseSysCache(tp);
160}
static Datum CharGetDatum(char X)
Definition postgres.h:132

References CharGetDatum(), elog, ERROR, fb(), Form_pg_amop, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache3().

Referenced by ExecIndexBuildScanKeys(), ExecInitExprRec(), expand_indexqual_rowcompare(), gen_prune_steps_from_opexps(), gincost_pattern(), match_clause_to_partition_key(), mergejoinscansel(), MJExamineQuals(), and ri_populate_fastpath_metadata().

◆ get_op_opfamily_sortfamily()

Oid get_op_opfamily_sortfamily ( Oid  opno,
Oid  opfamily 
)
extern

Definition at line 112 of file lsyscache.c.

113{
114 HeapTuple tp;
116 Oid result;
117
119 ObjectIdGetDatum(opno),
121 ObjectIdGetDatum(opfamily));
122 if (!HeapTupleIsValid(tp))
123 return InvalidOid;
125 result = amop_tup->amopsortfamily;
126 ReleaseSysCache(tp);
127 return result;
128}

References CharGetDatum(), fb(), Form_pg_amop, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache3().

Referenced by match_clause_to_ordering_op().

◆ get_op_opfamily_strategy()

int get_op_opfamily_strategy ( Oid  opno,
Oid  opfamily 
)
extern

◆ get_op_rettype()

Oid get_op_rettype ( Oid  opno)
extern

Definition at line 1526 of file lsyscache.c.

1527{
1528 HeapTuple tp;
1529
1531 if (HeapTupleIsValid(tp))
1532 {
1534 Oid result;
1535
1536 result = optup->oprresult;
1537 ReleaseSysCache(tp);
1538 return result;
1539 }
1540 else
1541 return InvalidOid;
1542}

References fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by gistvalidate(), spgproperty(), and spgvalidate().

◆ get_opclass_family()

Oid get_opclass_family ( Oid  opclass)
extern

Definition at line 1335 of file lsyscache.c.

1336{
1337 HeapTuple tp;
1339 Oid result;
1340
1341 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1342 if (!HeapTupleIsValid(tp))
1343 elog(ERROR, "cache lookup failed for opclass %u", opclass);
1345
1346 result = cla_tup->opcfamily;
1347 ReleaseSysCache(tp);
1348 return result;
1349}
END_CATALOG_STRUCT typedef FormData_pg_opclass * Form_pg_opclass
Definition pg_opclass.h:87

References elog, ERROR, fb(), Form_pg_opclass, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by build_replindex_scan_key(), ComputeIndexAttrs(), infer_collation_opclass_match(), IsIndexUsableForReplicaIdentityFull(), load_rangetype_info(), lookup_type_cache(), and propgraph_edge_get_ref_keys().

◆ get_opclass_input_type()

Oid get_opclass_input_type ( Oid  opclass)
extern

◆ get_opclass_method()

Oid get_opclass_method ( Oid  opclass)
extern

Definition at line 1405 of file lsyscache.c.

1406{
1407 HeapTuple tp;
1409 Oid result;
1410
1411 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1412 if (!HeapTupleIsValid(tp))
1413 elog(ERROR, "cache lookup failed for opclass %u", opclass);
1415
1416 result = cla_tup->opcmethod;
1417 ReleaseSysCache(tp);
1418 return result;
1419}

References elog, ERROR, fb(), Form_pg_opclass, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by GetOperatorFromCompareType().

◆ get_opclass_opfamily_and_input_type()

bool get_opclass_opfamily_and_input_type ( Oid  opclass,
Oid opfamily,
Oid opcintype 
)
extern

Definition at line 1380 of file lsyscache.c.

1381{
1382 HeapTuple tp;
1384
1385 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1386 if (!HeapTupleIsValid(tp))
1387 return false;
1388
1390
1391 *opfamily = cla_tup->opcfamily;
1392 *opcintype = cla_tup->opcintype;
1393
1394 ReleaseSysCache(tp);
1395
1396 return true;
1397}

References fb(), Form_pg_opclass, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by DefineIndex(), FindFKPeriodOpers(), GetOperatorFromCompareType(), gistproperty(), spgproperty(), and transformForPortionOfClause().

◆ get_opcode()

RegProcedure get_opcode ( Oid  opno)
extern

Definition at line 1478 of file lsyscache.c.

1479{
1480 HeapTuple tp;
1481
1483 if (HeapTupleIsValid(tp))
1484 {
1487
1488 result = optup->oprcode;
1489 ReleaseSysCache(tp);
1490 return result;
1491 }
1492 else
1493 return (RegProcedure) InvalidOid;
1494}

References fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by _bt_compare_scankey_args(), _bt_find_extreme_element(), _bt_preprocess_array_keys(), _bt_skiparray_strat_decrement(), _bt_skiparray_strat_increment(), AlterOpFamilyAdd(), build_pertrans_for_aggref(), build_replindex_scan_key(), BuildSpeculativeIndexInfo(), check_functions_in_node(), ComputeIndexAttrs(), contain_leaked_vars_walker(), convert_saop_to_hashed_saop_walker(), cost_qual_eval_walker(), DefineOpClass(), eqjoinsel(), ExecInitMemoize(), ExecInitSubPlan(), execTuplesHashPrepare(), execTuplesMatchPrepare(), generic_restriction_selectivity(), get_expr_result_type(), get_variable_range(), inclusion_get_strategy_procinfo(), inet_mcv_join_sel(), initialize_change_context(), lookup_type_cache(), make_partition_op_expr(), make_SAOP_expr(), match_pattern_prefix(), mcv_get_match_bitmap(), minmax_get_strategy_procinfo(), minmax_multi_get_strategy_procinfo(), mode_final(), networkjoinsel_semi(), networksel(), op_strict(), op_volatile(), OperatorLookup(), patternsel_common(), prefix_selectivity(), preparePresortedCols(), RelationGetExclusionInfo(), ri_HashCompareOp(), ri_populate_fastpath_metadata(), scalarineqsel(), select_equality_operator(), set_opfuncid(), set_sa_opfuncid(), statext_is_compatible_clause_internal(), std_typanalyze(), transformForPortionOfClause(), and var_eq_const().

◆ get_opfamily_member()

◆ get_opfamily_member_for_cmptype()

Oid get_opfamily_member_for_cmptype ( Oid  opfamily,
Oid  lefttype,
Oid  righttype,
CompareType  cmptype 
)
extern

Definition at line 199 of file lsyscache.c.

201{
203 StrategyNumber strategy;
204
205 opmethod = get_opfamily_method(opfamily);
206 strategy = IndexAmTranslateCompareType(cmptype, opmethod, opfamily, true);
207 if (!strategy)
208 return InvalidOid;
209 return get_opfamily_member(opfamily, lefttype, righttype, strategy);
210}
StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok)
Definition amapi.c:161
Oid get_opfamily_method(Oid opfid)
Definition lsyscache.c:1429
uint16 StrategyNumber
Definition stratnum.h:22

References fb(), get_opfamily_member(), get_opfamily_method(), IndexAmTranslateCompareType(), and InvalidOid.

Referenced by appendOrderByClause(), create_indexscan_plan(), DefineIndex(), find_window_run_conditions(), get_eclass_for_sortgroupclause(), get_equality_op_for_ordering_op(), get_ordering_op_for_equality_op(), get_relation_info(), lookup_proof_cache(), make_pathkey_from_sortinfo(), make_unique_from_pathkeys(), match_network_subset(), prepare_sort_from_pathkeys(), refresh_by_match_merge(), and select_equality_operator().

◆ get_opfamily_method()

Oid get_opfamily_method ( Oid  opfid)
extern

Definition at line 1429 of file lsyscache.c.

1430{
1431 HeapTuple tp;
1433 Oid result;
1434
1436 if (!HeapTupleIsValid(tp))
1437 elog(ERROR, "cache lookup failed for operator family %u", opfid);
1439
1440 result = opfform->opfmethod;
1441 ReleaseSysCache(tp);
1442 return result;
1443}
END_CATALOG_STRUCT typedef FormData_pg_opfamily * Form_pg_opfamily
Definition pg_opfamily.h:55

References elog, ERROR, fb(), Form_pg_opfamily, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by DefineIndex(), get_opfamily_member_for_cmptype(), mergejoinscansel(), and MJExamineQuals().

◆ get_opfamily_name()

char * get_opfamily_name ( Oid  opfid,
bool  missing_ok 
)
extern

Definition at line 1446 of file lsyscache.c.

1447{
1448 HeapTuple tup;
1449 char *opfname;
1451
1453
1454 if (!HeapTupleIsValid(tup))
1455 {
1456 if (!missing_ok)
1457 elog(ERROR, "cache lookup failed for operator family %u", opfid);
1458 return NULL;
1459 }
1460
1462 opfname = pstrdup(NameStr(opfform->opfname));
1463
1465
1466 return opfname;
1467}

References elog, ERROR, fb(), Form_pg_opfamily, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), and SearchSysCache1().

Referenced by ATAddForeignKeyConstraint(), blvalidate(), brinvalidate(), btvalidate(), ComputeIndexAttrs(), DefineIndex(), GetOperatorFromCompareType(), ginvalidate(), gistvalidate(), hashvalidate(), and spgvalidate().

◆ get_opfamily_proc()

◆ get_opname()

char * get_opname ( Oid  opno)
extern

Definition at line 1503 of file lsyscache.c.

1504{
1505 HeapTuple tp;
1506
1508 if (HeapTupleIsValid(tp))
1509 {
1511 char *result;
1512
1513 result = pstrdup(NameStr(optup->oprname));
1514 ReleaseSysCache(tp);
1515 return result;
1516 }
1517 else
1518 return NULL;
1519}

References fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by AlterOpFamilyAdd(), DefineIndex(), DefineOpClass(), OperatorUpd(), print_expr(), and show_sortorder_options().

◆ get_oprjoin()

RegProcedure get_oprjoin ( Oid  opno)
extern

Definition at line 1774 of file lsyscache.c.

1775{
1776 HeapTuple tp;
1777
1779 if (HeapTupleIsValid(tp))
1780 {
1783
1784 result = optup->oprjoin;
1785 ReleaseSysCache(tp);
1786 return result;
1787 }
1788 else
1789 return (RegProcedure) InvalidOid;
1790}

References fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by join_selectivity(), and scalararraysel().

◆ get_oprrest()

◆ get_ordering_op_for_equality_op()

Oid get_ordering_op_for_equality_op ( Oid  opno,
bool  use_lhs_type 
)
extern

Definition at line 364 of file lsyscache.c.

365{
368 int i;
369
370 /*
371 * Search pg_amop to see if the target operator is registered as the "="
372 * operator of any btree opfamily.
373 */
375
376 for (i = 0; i < catlist->n_members; i++)
377 {
378 HeapTuple tuple = &catlist->members[i]->tuple;
380 CompareType cmptype;
381
382 /* must be ordering index */
383 if (!get_opmethod_canorder(aform->amopmethod))
384 continue;
385
386 cmptype = IndexAmTranslateStrategy(aform->amopstrategy,
387 aform->amopmethod,
388 aform->amopfamily,
389 true);
390 if (cmptype == COMPARE_EQ)
391 {
392 /* Found a suitable opfamily, get matching ordering operator */
393 Oid typid;
394
395 typid = use_lhs_type ? aform->amoplefttype : aform->amoprighttype;
397 typid, typid,
398 COMPARE_LT);
399 if (OidIsValid(result))
400 break;
401 /* failure probably shouldn't happen, but keep looking if so */
402 }
403 }
404
406
407 return result;
408}
@ COMPARE_LT
Definition cmptype.h:34

References COMPARE_EQ, COMPARE_LT, fb(), Form_pg_amop, get_opfamily_member_for_cmptype(), get_opmethod_canorder(), GETSTRUCT(), i, IndexAmTranslateStrategy(), InvalidOid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by create_unique_paths().

◆ get_ordering_op_properties()

bool get_ordering_op_properties ( Oid  opno,
Oid opfamily,
Oid opcintype,
CompareType cmptype 
)
extern

Definition at line 261 of file lsyscache.c.

263{
264 bool result = false;
266 int i;
267
268 /* ensure outputs are initialized on failure */
269 *opfamily = InvalidOid;
270 *opcintype = InvalidOid;
271 *cmptype = COMPARE_INVALID;
272
273 /*
274 * Search pg_amop to see if the target operator is registered as the "<"
275 * or ">" operator of any btree opfamily.
276 */
278
279 for (i = 0; i < catlist->n_members; i++)
280 {
281 HeapTuple tuple = &catlist->members[i]->tuple;
284
285 /* must be ordering index */
286 if (!get_opmethod_canorder(aform->amopmethod))
287 continue;
288
290 aform->amopmethod,
291 aform->amopfamily,
292 true);
293
295 {
296 /* Found it ... should have consistent input types */
297 if (aform->amoplefttype == aform->amoprighttype)
298 {
299 /* Found a suitable opfamily, return info */
300 *opfamily = aform->amopfamily;
301 *opcintype = aform->amoplefttype;
302 *cmptype = am_cmptype;
303 result = true;
304 break;
305 }
306 }
307 }
308
310
311 return result;
312}

References COMPARE_GT, COMPARE_INVALID, COMPARE_LT, fb(), Form_pg_amop, get_opmethod_canorder(), GETSTRUCT(), i, IndexAmTranslateStrategy(), InvalidOid, ObjectIdGetDatum(), ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by build_expression_pathkey(), get_eclass_for_sortgroupclause(), get_equality_op_for_ordering_op(), get_relation_info(), make_pathkey_from_sortop(), PrepareSortSupportFromOrderingOp(), and transformWindowDefinitions().

◆ get_promoted_array_type()

Oid get_promoted_array_type ( Oid  typid)
extern

Definition at line 3006 of file lsyscache.c.

3007{
3008 Oid array_type = get_array_type(typid);
3009
3010 if (OidIsValid(array_type))
3011 return array_type;
3012 if (OidIsValid(get_element_type(typid)))
3013 return typid;
3014 return InvalidOid;
3015}
Oid get_element_type(Oid typid)
Definition lsyscache.c:2954
Oid get_array_type(Oid typid)
Definition lsyscache.c:2982

References get_array_type(), get_element_type(), InvalidOid, and OidIsValid.

Referenced by build_subplan(), and exprType().

◆ get_propgraph_label_name()

char * get_propgraph_label_name ( Oid  labeloid)
extern

Definition at line 3939 of file lsyscache.c.

3940{
3941 HeapTuple tuple;
3942 char *labelname;
3943
3945 if (!tuple)
3946 {
3947 elog(ERROR, "cache lookup failed for label %u", labeloid);
3948 return NULL;
3949 }
3951 ReleaseSysCache(tuple);
3952
3953 return labelname;
3954}
END_CATALOG_STRUCT typedef FormData_pg_propgraph_label * Form_pg_propgraph_label

References elog, ERROR, fb(), Form_pg_propgraph_label, GETSTRUCT(), NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), and SearchSysCache1().

Referenced by check_element_label_properties(), get_graph_label_expr(), get_path_elements_for_path_factor(), getObjectDescription(), and make_propgraphdef_labels().

◆ get_propgraph_property_name()

char * get_propgraph_property_name ( Oid  propoid)
extern

Definition at line 3957 of file lsyscache.c.

3958{
3959 HeapTuple tuple;
3960 char *propname;
3961
3963 if (!tuple)
3964 {
3965 elog(ERROR, "cache lookup failed for property %u", propoid);
3966 return NULL;
3967 }
3969 ReleaseSysCache(tuple);
3970
3971 return propname;
3972}
END_CATALOG_STRUCT typedef FormData_pg_propgraph_property * Form_pg_propgraph_property

References elog, ERROR, fb(), Form_pg_propgraph_property, GETSTRUCT(), NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), and SearchSysCache1().

Referenced by check_element_properties(), get_element_label_property_names(), get_rule_expr(), getObjectDescription(), make_propgraphdef_properties(), replace_property_refs_mutator(), and transformRangeGraphTable().

◆ get_publication_name()

char * get_publication_name ( Oid  pubid,
bool  missing_ok 
)
extern

Definition at line 3865 of file lsyscache.c.

3866{
3867 HeapTuple tup;
3868 char *pubname;
3870
3872
3873 if (!HeapTupleIsValid(tup))
3874 {
3875 if (!missing_ok)
3876 elog(ERROR, "cache lookup failed for publication %u", pubid);
3877 return NULL;
3878 }
3879
3881 pubname = pstrdup(NameStr(pubform->pubname));
3882
3884
3885 return pubname;
3886}
END_CATALOG_STRUCT typedef FormData_pg_publication * Form_pg_publication

References elog, ERROR, fb(), Form_pg_publication, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), and SearchSysCache1().

Referenced by ATExecAttachPartition(), getObjectDescription(), getObjectIdentityParts(), and getPublicationSchemaInfo().

◆ get_publication_oid()

Oid get_publication_oid ( const char pubname,
bool  missing_ok 
)
extern

Definition at line 3845 of file lsyscache.c.

3846{
3847 Oid oid;
3848
3850 CStringGetDatum(pubname));
3851 if (!OidIsValid(oid) && !missing_ok)
3852 ereport(ERROR,
3854 errmsg("publication \"%s\" does not exist", pubname)));
3855 return oid;
3856}
static Datum CStringGetDatum(const char *X)
Definition postgres.h:383
#define GetSysCacheOid1(cacheId, oidcol, key1)
Definition syscache.h:109

References CStringGetDatum(), ereport, errcode(), errmsg, ERROR, fb(), GetSysCacheOid1, and OidIsValid.

Referenced by get_object_address_unqualified(), and GetPublicationByName().

◆ get_range_collation()

Oid get_range_collation ( Oid  rangeOid)
extern

Definition at line 3628 of file lsyscache.c.

3629{
3630 HeapTuple tp;
3631
3633 if (HeapTupleIsValid(tp))
3634 {
3636 Oid result;
3637
3638 result = rngtup->rngcollation;
3639 ReleaseSysCache(tp);
3640 return result;
3641 }
3642 else
3643 return InvalidOid;
3644}

References fb(), Form_pg_range, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by CheckAttributeType().

◆ get_range_constructor2()

Oid get_range_constructor2 ( Oid  rangeOid)
extern

Definition at line 3653 of file lsyscache.c.

3654{
3655 HeapTuple tp;
3656
3658 if (HeapTupleIsValid(tp))
3659 {
3662
3663 result = rngtup->rngconstruct2;
3664 ReleaseSysCache(tp);
3665 return result;
3666 }
3667 else
3668 elog(ERROR, "cache lookup failed for range type %u", rangeOid);
3669}

References elog, ERROR, fb(), Form_pg_range, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by transformForPortionOfClause().

◆ get_range_multirange()

Oid get_range_multirange ( Oid  rangeOid)
extern

◆ get_range_subtype()

◆ get_rel_name()

char * get_rel_name ( Oid  relid)
extern

Definition at line 2121 of file lsyscache.c.

2122{
2123 HeapTuple tp;
2124
2126 if (HeapTupleIsValid(tp))
2127 {
2129 char *result;
2130
2131 result = pstrdup(NameStr(reltup->relname));
2132 ReleaseSysCache(tp);
2133 return result;
2134 }
2135 else
2136 return NULL;
2137}
FormData_pg_class * Form_pg_class
Definition pg_class.h:160

References fb(), GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by adjust_appendrel_attrs_mutator(), adjust_inherited_attnums(), AdjustNotNullInheritance(), AlterCheckConstrEnforceabilityRecurse(), AlterPropGraph(), AlterPublicationOptions(), AlterSubscription_refresh(), AlterSubscription_refresh_seq(), AlterTableNamespace(), array_from_column_list(), ATExecAlterConstraint(), ATExecChangeOwner(), ATPrepAddPrimaryKey(), BeginCopyTo(), build_new_indexes(), check_element_properties(), check_enable_rls(), check_new_partition_bound(), check_parent_values_in_new_partitions(), check_partition_bounds_for_split_list(), check_partition_bounds_for_split_range(), check_publications_origin_sequences(), check_publications_origin_tables(), collectPartitionIndexExtDeps(), convert_column_name(), CreateTriggerFiringOn(), DefineRelation(), do_autovacuum(), EnableDisableRule(), errdetail_apply_conflict(), exec_object_restorecon(), ExecCheckPermissions(), execCurrentOf(), expand_col_privileges(), explain_get_index_name(), ExplainTargetRel(), FinishSyncWorker(), get_edge_oid(), get_path_elements_for_path_factor(), get_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_name(), get_relation_policy_oid(), get_rewrite_oid(), get_trigger_oid(), get_vertex_oid(), gincost_pattern(), has_sequence_privilege_id(), has_sequence_privilege_id_id(), has_sequence_privilege_name_id(), heap_truncate_check_FKs(), InitializeLogRepWorker(), InsertRule(), LockTableRecurse(), LockViewRecurse_walker(), make_modifytable(), make_propgraphdef_elements(), makeWholeRowVar(), map_sql_schema_to_xmlschema_types(), MarkInheritDetached(), overexplain_range_table(), perform_work_item(), pg_clear_attribute_stats(), pg_decode_change(), pg_extension_config_dump(), pg_prewarm(), pg_sequence_parameters(), pgpa_compute_identifier_by_rti(), pgpa_create_identifiers_for_planned_stmt(), pgpa_output_relation_name(), pgpa_planner_apply_scan_advice(), pgpa_walker_index_target_matches_plan(), postgresExplainForeignScan(), process_owned_by(), QueueNNConstraintValidation(), rebuild_relation_finish_concurrent(), refuseDupeIndexAttach(), reindex_index(), reindex_relation(), ReindexMultipleInternal(), ReindexPartitions(), ReindexRelationConcurrently(), RememberClusterOnForRebuilding(), RememberReplicaIdentityForRebuilding(), RemoveSubscriptionRel(), RenameConstraintById(), renametrig(), repack_is_permitted_for_relation(), satisfies_hash_partition(), set_rtable_names(), show_modifytable_info(), start_repack_decoding_worker(), subquery_planner(), swap_relation_files(), SysCacheGetAttrNotNull(), table_to_xml_internal(), TargetPrivilegesCheck(), transformAlterTableStmt(), transformLabelExpr(), transformPartitionCmdForSplit(), and verifyNotNullPKCompatible().

◆ get_rel_namespace()

◆ get_rel_persistence()

char get_rel_persistence ( Oid  relid)
extern

Definition at line 2271 of file lsyscache.c.

2272{
2273 HeapTuple tp;
2275 char result;
2276
2278 if (!HeapTupleIsValid(tp))
2279 elog(ERROR, "cache lookup failed for relation %u", relid);
2281 result = reltup->relpersistence;
2282 ReleaseSysCache(tp);
2283
2284 return result;
2285}

References elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by AlterPropGraph(), DefineIndex(), index_drop(), RangeVarCallbackForLockTable(), ReindexIndex(), ReindexMultipleInternal(), ReindexTable(), and set_rel_consider_parallel().

◆ get_rel_relam()

Oid get_rel_relam ( Oid  relid)
extern

Definition at line 2293 of file lsyscache.c.

2294{
2295 HeapTuple tp;
2297 Oid result;
2298
2300 if (!HeapTupleIsValid(tp))
2301 elog(ERROR, "cache lookup failed for relation %u", relid);
2303 result = reltup->relam;
2304 ReleaseSysCache(tp);
2305
2306 return result;
2307}

References elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by DefineRelation().

◆ get_rel_relispartition()

bool get_rel_relispartition ( Oid  relid)
extern

◆ get_rel_relkind()

char get_rel_relkind ( Oid  relid)
extern

Definition at line 2196 of file lsyscache.c.

2197{
2198 HeapTuple tp;
2199
2201 if (HeapTupleIsValid(tp))
2202 {
2204 char result;
2205
2206 result = reltup->relkind;
2207 ReleaseSysCache(tp);
2208 return result;
2209 }
2210 else
2211 return '\0';
2212}

References fb(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by AlterPublicationOptions(), AlterSubscription_refresh(), AlterTableMoveAll(), AlterTypeNamespaceInternal(), AlterTypeOwner(), ATExecAlterConstrDeferrability(), ATExecAlterFKConstrEnforceability(), ATExecChangeOwner(), AttachPartitionForeignKey(), BeginCopyTo(), check_rel_can_be_partition(), check_relation_privileges(), CreateSubscription(), CreateTriggerFiringOn(), doDeletion(), EnableDisableRule(), exec_object_restorecon(), ExecCheckPermissions(), FetchRelationStates(), get_object_type(), get_rel_sync_entry(), get_tables_to_repack_partitioned(), getOwnedSequences_internal(), GetPubPartitionOptionRelations(), GetSchemaPublicationRelations(), GetSubscriptionRelations(), has_sequence_privilege_id(), has_sequence_privilege_id_id(), has_sequence_privilege_id_name(), has_sequence_privilege_name(), has_sequence_privilege_name_id(), has_sequence_privilege_name_name(), HasSubscriptionTables(), is_table_publishable_in_publication(), LockTableCommand(), pg_get_serial_sequence(), pg_get_triggerdef_worker(), pg_partition_tree(), pg_prewarm(), ProcessSyncingTablesForApply(), ProcessUtilitySlow(), QueueFKConstraintValidation(), RangeVarCallbackForAlterRelation(), RangeVarCallbackForDblink(), RangeVarCallbackForLockTable(), RangeVarCallbackForPolicy(), RangeVarCallbackForReindexIndex(), RangeVarCallbackForRenameRule(), RangeVarCallbackForRenameTrigger(), RangeVarCallbackForStats(), RangeVarCallbackMaintainsTable(), RangeVarCallbackOwnsRelation(), RangeVarGetAndCheckCreationNamespace(), ReindexIndex(), ReindexMultipleInternal(), ReindexPartitions(), ReindexRelationConcurrently(), ReindexTable(), RelationBuildPartitionDesc(), RememberAllDependentForRebuilding(), RemoveSubscriptionRel(), renameatt_check(), RenameRelation(), RenameType(), ri_LoadConstraintInfo(), sepgsql_attribute_drop(), sepgsql_attribute_post_create(), sepgsql_attribute_relabel(), sepgsql_attribute_setattr(), sepgsql_relation_drop(), sepgsql_relation_relabel(), sepgsql_relation_setattr(), and sepgsql_relation_truncate().

◆ get_rel_tablespace()

Oid get_rel_tablespace ( Oid  relid)
extern

Definition at line 2247 of file lsyscache.c.

2248{
2249 HeapTuple tp;
2250
2252 if (HeapTupleIsValid(tp))
2253 {
2255 Oid result;
2256
2257 result = reltup->reltablespace;
2258 ReleaseSysCache(tp);
2259 return result;
2260 }
2261 else
2262 return InvalidOid;
2263}

References fb(), GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by DefineRelation(), pg_get_constraintdef_worker(), and pg_get_indexdef_worker().

◆ get_rel_type_id()

Oid get_rel_type_id ( Oid  relid)
extern

◆ get_relname_relid()

◆ get_subscription_name()

char * get_subscription_name ( Oid  subid,
bool  missing_ok 
)
extern

Definition at line 3915 of file lsyscache.c.

3916{
3917 HeapTuple tup;
3918 char *subname;
3920
3922
3923 if (!HeapTupleIsValid(tup))
3924 {
3925 if (!missing_ok)
3926 elog(ERROR, "cache lookup failed for subscription %u", subid);
3927 return NULL;
3928 }
3929
3931 subname = pstrdup(NameStr(subform->subname));
3932
3934
3935 return subname;
3936}
NameData subname
END_CATALOG_STRUCT typedef FormData_pg_subscription * Form_pg_subscription

References elog, ERROR, fb(), Form_pg_subscription, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), SearchSysCache1(), and subname.

Referenced by getObjectDescription(), getObjectIdentityParts(), and RemoveSubscriptionRel().

◆ get_subscription_oid()

Oid get_subscription_oid ( const char subname,
bool  missing_ok 
)
extern

Definition at line 3895 of file lsyscache.c.

3896{
3897 Oid oid;
3898
3901 if (!OidIsValid(oid) && !missing_ok)
3902 ereport(ERROR,
3904 errmsg("subscription \"%s\" does not exist", subname)));
3905 return oid;
3906}
Oid MyDatabaseId
Definition globals.c:96

References CStringGetDatum(), ereport, errcode(), errmsg, ERROR, fb(), GetSysCacheOid2, MyDatabaseId, ObjectIdGetDatum(), OidIsValid, and subname.

Referenced by binary_upgrade_add_sub_rel_state(), binary_upgrade_replorigin_advance(), and get_object_address_unqualified().

◆ get_transform_fromsql()

Oid get_transform_fromsql ( Oid  typid,
Oid  langid,
List trftypes 
)
extern

Definition at line 2313 of file lsyscache.c.

2314{
2315 HeapTuple tup;
2316
2317 if (!list_member_oid(trftypes, typid))
2318 return InvalidOid;
2319
2321 ObjectIdGetDatum(langid));
2322 if (HeapTupleIsValid(tup))
2323 {
2324 Oid funcid;
2325
2326 funcid = ((Form_pg_transform) GETSTRUCT(tup))->trffromsql;
2328 return funcid;
2329 }
2330 else
2331 return InvalidOid;
2332}
bool list_member_oid(const List *list, Oid datum)
Definition list.c:722
END_CATALOG_STRUCT typedef FormData_pg_transform * Form_pg_transform

References fb(), Form_pg_transform, GETSTRUCT(), HeapTupleIsValid, InvalidOid, list_member_oid(), ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache2().

Referenced by plperl_call_perl_func(), plperl_hash_from_tuple(), plperl_ref_from_pg_array(), and PLy_input_setup_func().

◆ get_transform_tosql()

Oid get_transform_tosql ( Oid  typid,
Oid  langid,
List trftypes 
)
extern

Definition at line 2335 of file lsyscache.c.

2336{
2337 HeapTuple tup;
2338
2339 if (!list_member_oid(trftypes, typid))
2340 return InvalidOid;
2341
2343 ObjectIdGetDatum(langid));
2344 if (HeapTupleIsValid(tup))
2345 {
2346 Oid funcid;
2347
2348 funcid = ((Form_pg_transform) GETSTRUCT(tup))->trftosql;
2350 return funcid;
2351 }
2352 else
2353 return InvalidOid;
2354}

References fb(), Form_pg_transform, GETSTRUCT(), HeapTupleIsValid, InvalidOid, list_member_oid(), ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache2().

Referenced by plperl_sv_to_datum(), and PLy_output_setup_func().

◆ get_typ_typrelid()

Oid get_typ_typrelid ( Oid  typid)
extern

Definition at line 2926 of file lsyscache.c.

2927{
2928 HeapTuple tp;
2929
2931 if (HeapTupleIsValid(tp))
2932 {
2934 Oid result;
2935
2936 result = typtup->typrelid;
2937 ReleaseSysCache(tp);
2938 return result;
2939 }
2940 else
2941 return InvalidOid;
2942}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by ATPostAlterTypeCleanup(), CheckAttributeType(), find_expr_references_walker(), process_function_rte_ref(), and processIndirection().

◆ get_typavgwidth()

int32 get_typavgwidth ( Oid  typid,
int32  typmod 
)
extern

Definition at line 2773 of file lsyscache.c.

2774{
2775 int typlen = get_typlen(typid);
2777
2778 /*
2779 * Easy if it's a fixed-width type
2780 */
2781 if (typlen > 0)
2782 return typlen;
2783
2784 /*
2785 * type_maximum_size knows the encoding of typmod for some datatypes;
2786 * don't duplicate that knowledge here.
2787 */
2788 maxwidth = type_maximum_size(typid, typmod);
2789 if (maxwidth > 0)
2790 {
2791 /*
2792 * For BPCHAR, the max width is also the only width. Otherwise we
2793 * need to guess about the typical data width given the max. A sliding
2794 * scale for percentage of max width seems reasonable.
2795 */
2796 if (typid == BPCHAROID)
2797 return maxwidth;
2798 if (maxwidth <= 32)
2799 return maxwidth; /* assume full width */
2800 if (maxwidth < 1000)
2801 return 32 + (maxwidth - 32) / 2; /* assume 50% */
2802
2803 /*
2804 * Beyond 1000, assume we're looking at something like
2805 * "varchar(10000)" where the limit isn't actually reached often, and
2806 * use a fixed estimate.
2807 */
2808 return 32 + (1000 - 32) / 2;
2809 }
2810
2811 /*
2812 * Oops, we have no idea ... wild guess time.
2813 */
2814 return 32;
2815}
int32 type_maximum_size(Oid type_oid, int32 typemod)
int16 get_typlen(Oid typid)
Definition lsyscache.c:2390

References fb(), get_typlen(), and type_maximum_size().

Referenced by add_row_identity_var(), create_one_window_path(), find_placeholder_info(), get_agg_clause_costs(), get_expr_width(), get_rel_data_width(), set_append_rel_size(), and set_rel_width().

◆ get_typbyval()

bool get_typbyval ( Oid  typid)
extern

Definition at line 2415 of file lsyscache.c.

2416{
2417 HeapTuple tp;
2418
2420 if (HeapTupleIsValid(tp))
2421 {
2423 bool result;
2424
2425 result = typtup->typbyval;
2426 ReleaseSysCache(tp);
2427 return result;
2428 }
2429 else
2430 return false;
2431}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by brin_range_deserialize(), and brin_range_serialize().

◆ get_typcollation()

◆ get_typdefault()

Node * get_typdefault ( Oid  typid)
extern

Definition at line 2643 of file lsyscache.c.

2644{
2647 Datum datum;
2648 bool isNull;
2649 Node *expr;
2650
2653 elog(ERROR, "cache lookup failed for type %u", typid);
2655
2656 /*
2657 * typdefault and typdefaultbin are potentially null, so don't try to
2658 * access 'em as struct fields. Must do it the hard way with
2659 * SysCacheGetAttr.
2660 */
2661 datum = SysCacheGetAttr(TYPEOID,
2662 typeTuple,
2664 &isNull);
2665
2666 if (!isNull)
2667 {
2668 /* We have an expression default */
2669 expr = stringToNode(TextDatumGetCString(datum));
2670 }
2671 else
2672 {
2673 /* Perhaps we have a plain literal default */
2674 datum = SysCacheGetAttr(TYPEOID,
2675 typeTuple,
2677 &isNull);
2678
2679 if (!isNull)
2680 {
2681 char *strDefaultVal;
2682
2683 /* Convert text datum to C string */
2685 /* Convert C string to a value of the given type */
2686 datum = OidInputFunctionCall(type->typinput, strDefaultVal,
2688 /* Build a Const node containing the value */
2689 expr = (Node *) makeConst(typid,
2690 -1,
2691 type->typcollation,
2692 type->typlen,
2693 datum,
2694 false,
2695 type->typbyval);
2697 }
2698 else
2699 {
2700 /* No default */
2701 expr = NULL;
2702 }
2703 }
2704
2706
2707 return expr;
2708}
#define TextDatumGetCString(d)
Definition builtins.h:99
Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod)
Definition fmgr.c:1755
Oid getTypeIOParam(HeapTuple typeTuple)
Definition lsyscache.c:2496
Const * makeConst(Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval)
Definition makefuncs.c:350
void * stringToNode(const char *str)
Definition read.c:90
Definition nodes.h:135
const char * type

References elog, ERROR, fb(), Form_pg_type, GETSTRUCT(), getTypeIOParam(), HeapTupleIsValid, makeConst(), ObjectIdGetDatum(), OidInputFunctionCall(), pfree(), ReleaseSysCache(), SearchSysCache1(), stringToNode(), SysCacheGetAttr(), TextDatumGetCString, and type.

Referenced by build_column_default().

◆ get_type_category_preferred()

void get_type_category_preferred ( Oid  typid,
char typcategory,
bool typispreferred 
)
extern

◆ get_type_io_data()

void get_type_io_data ( Oid  typid,
IOFuncSelector  which_func,
int16 typlen,
bool typbyval,
char typalign,
char typdelim,
Oid typioparam,
Oid func 
)
extern

Definition at line 2518 of file lsyscache.c.

2526{
2529
2530 /*
2531 * In bootstrap mode, pass it off to bootstrap.c. This hack allows us to
2532 * use array_in and array_out during bootstrap.
2533 */
2535 {
2536 Oid typinput;
2537 Oid typoutput;
2538 Oid typcollation;
2539
2541 typlen,
2542 typbyval,
2543 typalign,
2544 typdelim,
2545 typioparam,
2546 &typinput,
2547 &typoutput,
2548 &typcollation);
2549 switch (which_func)
2550 {
2551 case IOFunc_input:
2552 *func = typinput;
2553 break;
2554 case IOFunc_output:
2555 *func = typoutput;
2556 break;
2557 default:
2558 elog(ERROR, "binary I/O not supported during bootstrap");
2559 break;
2560 }
2561 return;
2562 }
2563
2566 elog(ERROR, "cache lookup failed for type %u", typid);
2568
2569 *typlen = typeStruct->typlen;
2570 *typbyval = typeStruct->typbyval;
2571 *typalign = typeStruct->typalign;
2572 *typdelim = typeStruct->typdelim;
2573 *typioparam = getTypeIOParam(typeTuple);
2574 switch (which_func)
2575 {
2576 case IOFunc_input:
2577 *func = typeStruct->typinput;
2578 break;
2579 case IOFunc_output:
2580 *func = typeStruct->typoutput;
2581 break;
2582 case IOFunc_receive:
2583 *func = typeStruct->typreceive;
2584 break;
2585 case IOFunc_send:
2586 *func = typeStruct->typsend;
2587 break;
2588 }
2590}
void boot_get_type_io_data(Oid typid, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *typinput, Oid *typoutput, Oid *typcollation)
Definition bootstrap.c:1011
#define IsBootstrapProcessingMode()
Definition miscadmin.h:495
char typalign
Definition pg_type.h:178

References boot_get_type_io_data(), elog, ERROR, fb(), Form_pg_type, GETSTRUCT(), getTypeIOParam(), HeapTupleIsValid, IOFunc_input, IOFunc_output, IOFunc_receive, IOFunc_send, IsBootstrapProcessingMode, ObjectIdGetDatum(), ReleaseSysCache(), SearchSysCache1(), and typalign.

Referenced by array_in(), array_out(), array_recv(), array_send(), array_to_text_internal(), get_multirange_io_data(), get_range_io_data(), and plperl_ref_from_pg_array().

◆ get_typisdefined()

bool get_typisdefined ( Oid  typid)
extern

Definition at line 2366 of file lsyscache.c.

2367{
2368 HeapTuple tp;
2369
2371 if (HeapTupleIsValid(tp))
2372 {
2374 bool result;
2375
2376 result = typtup->typisdefined;
2377 ReleaseSysCache(tp);
2378 return result;
2379 }
2380 else
2381 return false;
2382}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by DefineRange(), DefineType(), moveArrayTypeName(), and RenameTypeInternal().

◆ get_typlen()

◆ get_typlenbyval()

◆ get_typlenbyvalalign()

void get_typlenbyvalalign ( Oid  typid,
int16 typlen,
bool typbyval,
char typalign 
)
extern

◆ get_typmodin()

Oid get_typmodin ( Oid  typid)
extern

Definition at line 3201 of file lsyscache.c.

3202{
3203 HeapTuple tp;
3204
3206 if (HeapTupleIsValid(tp))
3207 {
3209 Oid result;
3210
3211 result = typtup->typmodin;
3212 ReleaseSysCache(tp);
3213 return result;
3214 }
3215 else
3216 return InvalidOid;
3217}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

◆ get_typstorage()

char get_typstorage ( Oid  typid)
extern

Definition at line 2614 of file lsyscache.c.

2615{
2616 HeapTuple tp;
2617
2619 if (HeapTupleIsValid(tp))
2620 {
2622 char result;
2623
2624 result = typtup->typstorage;
2625 ReleaseSysCache(tp);
2626 return result;
2627 }
2628 else
2629 return TYPSTORAGE_PLAIN;
2630}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), result, and SearchSysCache1().

Referenced by GetAttributeStorage().

◆ get_typsubscript()

RegProcedure get_typsubscript ( Oid  typid,
Oid typelemp 
)
extern

Definition at line 3292 of file lsyscache.c.

3293{
3294 HeapTuple tp;
3295
3297 if (HeapTupleIsValid(tp))
3298 {
3300 RegProcedure handler = typform->typsubscript;
3301
3302 if (typelemp)
3303 *typelemp = typform->typelem;
3304 ReleaseSysCache(tp);
3305 return handler;
3306 }
3307 else
3308 {
3309 if (typelemp)
3311 return InvalidOid;
3312 }
3313}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by exec_check_rw_parameter(), and getSubscriptingRoutines().

◆ get_typtype()

◆ getBaseType()

◆ getBaseTypeAndTypmod()

Oid getBaseTypeAndTypmod ( Oid  typid,
int32 typmod 
)
extern

Definition at line 2733 of file lsyscache.c.

2734{
2735 /*
2736 * We loop to find the bottom base type in a stack of domains.
2737 */
2738 for (;;)
2739 {
2740 HeapTuple tup;
2742
2744 if (!HeapTupleIsValid(tup))
2745 elog(ERROR, "cache lookup failed for type %u", typid);
2747 if (typTup->typtype != TYPTYPE_DOMAIN)
2748 {
2749 /* Not a domain, so done */
2751 break;
2752 }
2753
2754 Assert(*typmod == -1);
2755 typid = typTup->typbasetype;
2756 *typmod = typTup->typtypmod;
2757
2759 }
2760
2761 return typid;
2762}

References Assert, elog, ERROR, fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by ATExecAddColumn(), build_coercion_expression(), cache_record_field_properties(), coerce_null_to_domain(), coerce_record_to_complex(), coerce_type(), expand_insert_targetlist(), getBaseType(), lookup_type_cache(), map_sql_type_to_xmlschema_type(), prepare_column_cache(), SendRowDescriptionMessage(), transformAssignmentIndirection(), transformContainerType(), and transformTypeCast().

◆ getSubscriptingRoutines()

const SubscriptRoutines * getSubscriptingRoutines ( Oid  typid,
Oid typelemp 
)
extern

Definition at line 3325 of file lsyscache.c.

3326{
3327 RegProcedure typsubscript = get_typsubscript(typid, typelemp);
3328
3329 if (!OidIsValid(typsubscript))
3330 return NULL;
3331
3332 return (const struct SubscriptRoutines *)
3333 DatumGetPointer(OidFunctionCall0(typsubscript));
3334}
#define OidFunctionCall0(functionId)
Definition fmgr.h:720
RegProcedure get_typsubscript(Oid typid, Oid *typelemp)
Definition lsyscache.c:3292

References DatumGetPointer(), fb(), get_typsubscript(), OidFunctionCall0, and OidIsValid.

Referenced by contain_leaked_vars_walker(), contain_nonstrict_functions_walker(), ExecInitSubscriptingRef(), and transformContainerSubscripts().

◆ getTypeBinaryInputInfo()

void getTypeBinaryInputInfo ( Oid  type,
Oid typReceive,
Oid typIOParam 
)
extern

Definition at line 3135 of file lsyscache.c.

3136{
3139
3142 elog(ERROR, "cache lookup failed for type %u", type);
3144
3145 if (!pt->typisdefined)
3146 ereport(ERROR,
3148 errmsg("type %s is only a shell",
3149 format_type_be(type))));
3150 if (!OidIsValid(pt->typreceive))
3151 ereport(ERROR,
3153 errmsg("no binary input function available for type %s",
3154 format_type_be(type))));
3155
3156 *typReceive = pt->typreceive;
3158
3160}

References elog, ereport, errcode(), errmsg, ERROR, fb(), Form_pg_type, format_type_be(), GETSTRUCT(), getTypeIOParam(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache1(), and type.

Referenced by array_agg_deserialize(), CopyFromBinaryInFunc(), domain_state_setup(), exec_bind_message(), parse_fcall_arguments(), record_recv(), slot_modify_data(), and slot_store_data().

◆ getTypeBinaryOutputInfo()

void getTypeBinaryOutputInfo ( Oid  type,
Oid typSend,
bool typIsVarlena 
)
extern

Definition at line 3168 of file lsyscache.c.

3169{
3172
3175 elog(ERROR, "cache lookup failed for type %u", type);
3177
3178 if (!pt->typisdefined)
3179 ereport(ERROR,
3181 errmsg("type %s is only a shell",
3182 format_type_be(type))));
3183 if (!OidIsValid(pt->typsend))
3184 ereport(ERROR,
3186 errmsg("no binary output function available for type %s",
3187 format_type_be(type))));
3188
3189 *typSend = pt->typsend;
3190 *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
3191
3193}

References elog, ereport, errcode(), errmsg, ERROR, fb(), Form_pg_type, format_type_be(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache1(), and type.

Referenced by array_agg_serialize(), CopyToBinaryOutFunc(), printtup_prepare_info(), record_send(), SendFunctionResult(), and serialize_prepare_info().

◆ getTypeInputInfo()

void getTypeInputInfo ( Oid  type,
Oid typInput,
Oid typIOParam 
)
extern

Definition at line 3069 of file lsyscache.c.

3070{
3073
3076 elog(ERROR, "cache lookup failed for type %u", type);
3078
3079 if (!pt->typisdefined)
3080 ereport(ERROR,
3082 errmsg("type %s is only a shell",
3083 format_type_be(type))));
3084 if (!OidIsValid(pt->typinput))
3085 ereport(ERROR,
3087 errmsg("no input function available for type %s",
3088 format_type_be(type))));
3089
3090 *typInput = pt->typinput;
3092
3094}

References elog, ereport, errcode(), errmsg, ERROR, fb(), Form_pg_type, format_type_be(), GETSTRUCT(), getTypeIOParam(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache1(), and type.

Referenced by _sv_to_datum_finfo(), check_functions_in_node(), CopyFromTextLikeInFunc(), cost_qual_eval_walker(), DefineAggregate(), domain_state_setup(), eval_const_expressions_mutator(), exec_bind_message(), ExecInitExprRec(), ExecInitJsonExpr(), ExecInitTableFuncScan(), GetAggInitVal(), GetAggInitVal(), GetAggInitVal(), hstore_populate_record(), parse_fcall_arguments(), pg_input_is_valid_common(), plperl_spi_prepare(), pltcl_SPI_prepare(), PLy_output_setup_func(), prepare_column_cache(), record_in(), slot_modify_data(), slot_store_data(), statext_mcv_import(), transformJsonArrayQueryConstructor(), and TupleDescGetAttInMetadata().

◆ getTypeIOParam()

Oid getTypeIOParam ( HeapTuple  typeTuple)
extern

Definition at line 2496 of file lsyscache.c.

2497{
2499
2500 /*
2501 * Array types get their typelem as parameter; everybody else gets their
2502 * own type OID as parameter.
2503 */
2504 if (OidIsValid(typeStruct->typelem))
2505 return typeStruct->typelem;
2506 else
2507 return typeStruct->oid;
2508}

References fb(), Form_pg_type, GETSTRUCT(), and OidIsValid.

Referenced by compile_plperl_function(), compile_pltcl_function(), get_typdefault(), get_type_io_data(), getTypeBinaryInputInfo(), getTypeInputInfo(), plsample_func_handler(), and stringTypeDatum().

◆ getTypeOutputInfo()

void getTypeOutputInfo ( Oid  type,
Oid typOutput,
bool typIsVarlena 
)
extern

Definition at line 3102 of file lsyscache.c.

3103{
3106
3109 elog(ERROR, "cache lookup failed for type %u", type);
3111
3112 if (!pt->typisdefined)
3113 ereport(ERROR,
3115 errmsg("type %s is only a shell",
3116 format_type_be(type))));
3117 if (!OidIsValid(pt->typoutput))
3118 ereport(ERROR,
3120 errmsg("no output function available for type %s",
3121 format_type_be(type))));
3122
3123 *typOutput = pt->typoutput;
3124 *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
3125
3127}

References elog, ereport, errcode(), errmsg, ERROR, fb(), Form_pg_type, format_type_be(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache1(), and type.

Referenced by brin_minmax_multi_summary_out(), brin_page_items(), build_concat_foutcache(), BuildIndexValueDescription(), BuildParamLogString(), check_functions_in_node(), convert_value_to_string(), CopyToTextLikeOutFunc(), cost_qual_eval_walker(), create_foreign_modify(), debugtup(), deparseConst(), eval_const_expressions_mutator(), ExecBuildSlotPartitionKeyDescription(), ExecBuildSlotValueDescription(), ExecInitExprRec(), get_const_expr(), gist_page_items(), hstore_from_record(), json_categorize_type(), map_sql_value_to_xml_value(), pg_stats_ext_mcvlist_items(), plperl_hash_from_tuple(), plperl_sv_to_literal(), pltcl_build_tuple_argument(), pltcl_set_tuple_values(), PLy_input_setup_func(), prepare_query_params(), print_expr(), printtup_prepare_info(), record_out(), ri_ReportViolation(), SendFunctionResult(), serialize_prepare_info(), set_limit(), SPI_getvalue(), text_format(), and tuple_to_stringinfo().

◆ op_hashjoinable()

bool op_hashjoinable ( Oid  opno,
Oid  inputtype 
)
extern

Definition at line 1630 of file lsyscache.c.

1631{
1632 bool result = false;
1633 HeapTuple tp;
1634 TypeCacheEntry *typentry;
1635
1636 /* As in op_mergejoinable, let the typcache handle the hard cases */
1637 if (opno == ARRAY_EQ_OP)
1638 {
1639 typentry = lookup_type_cache(inputtype, TYPECACHE_HASH_PROC);
1640 if (typentry->hash_proc == F_HASH_ARRAY)
1641 result = true;
1642 }
1643 else if (opno == RECORD_EQ_OP)
1644 {
1645 typentry = lookup_type_cache(inputtype, TYPECACHE_HASH_PROC);
1646 if (typentry->hash_proc == F_HASH_RECORD)
1647 result = true;
1648 }
1649 else
1650 {
1651 /* For all other operators, rely on pg_operator.oprcanhash */
1653 if (HeapTupleIsValid(tp))
1654 {
1656
1657 result = optup->oprcanhash;
1658 ReleaseSysCache(tp);
1659 }
1660 }
1661 return result;
1662}
TypeCacheEntry * lookup_type_cache(Oid type_id, int flags)
Definition typcache.c:389
#define TYPECACHE_HASH_PROC
Definition typcache.h:142

References fb(), Form_pg_operator, GETSTRUCT(), TypeCacheEntry::hash_proc, HeapTupleIsValid, lookup_type_cache(), ObjectIdGetDatum(), ReleaseSysCache(), result, SearchSysCache1(), and TYPECACHE_HASH_PROC.

Referenced by addTargetToSortList(), check_hashjoinable(), compute_semijoin_info(), generate_join_implied_equalities_normal(), and hash_ok_operator().

◆ op_in_opfamily()

◆ op_input_types()

void op_input_types ( Oid  opno,
Oid lefttype,
Oid righttype 
)
extern

Definition at line 1551 of file lsyscache.c.

1552{
1553 HeapTuple tp;
1555
1557 if (!HeapTupleIsValid(tp)) /* shouldn't happen */
1558 elog(ERROR, "cache lookup failed for operator %u", opno);
1560 *lefttype = optup->oprleft;
1561 *righttype = optup->oprright;
1562 ReleaseSysCache(tp);
1563}

References elog, ERROR, fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), and SearchSysCache1().

Referenced by CheckIndexCompatible(), initialize_mergeclause_eclasses(), process_equivalence(), reconsider_full_join_clause(), reconsider_outer_join_clause(), ri_HashCompareOp(), and typeDepNeeded().

◆ op_is_safe_index_member()

bool op_is_safe_index_member ( Oid  opno)
extern

Definition at line 873 of file lsyscache.c.

874{
875 bool result = false;
877 int i;
878
879 /*
880 * Search pg_amop to see if the target operator is registered for any
881 * btree or hash opfamily.
882 */
884
885 for (i = 0; i < catlist->n_members; i++)
886 {
887 HeapTuple tuple = &catlist->members[i]->tuple;
889
890 /* Check if the AM is B-tree or Hash */
891 if (aform->amopmethod == BTREE_AM_OID ||
892 aform->amopmethod == HASH_AM_OID)
893 {
894 result = true;
895 break;
896 }
897 }
898
900
901 return result;
902}

References fb(), Form_pg_amop, GETSTRUCT(), i, ObjectIdGetDatum(), ReleaseSysCacheList, result, and SearchSysCacheList1.

Referenced by sublink_testexpr_is_not_nullable().

◆ op_mergejoinable()

bool op_mergejoinable ( Oid  opno,
Oid  inputtype 
)
extern

Definition at line 1579 of file lsyscache.c.

1580{
1581 bool result = false;
1582 HeapTuple tp;
1583 TypeCacheEntry *typentry;
1584
1585 /*
1586 * For array_eq or record_eq, we can sort if the element or field types
1587 * are all sortable. We could implement all the checks for that here, but
1588 * the typcache already does that and caches the results too, so let's
1589 * rely on the typcache.
1590 */
1591 if (opno == ARRAY_EQ_OP)
1592 {
1593 typentry = lookup_type_cache(inputtype, TYPECACHE_CMP_PROC);
1594 if (typentry->cmp_proc == F_BTARRAYCMP)
1595 result = true;
1596 }
1597 else if (opno == RECORD_EQ_OP)
1598 {
1599 typentry = lookup_type_cache(inputtype, TYPECACHE_CMP_PROC);
1600 if (typentry->cmp_proc == F_BTRECORDCMP)
1601 result = true;
1602 }
1603 else
1604 {
1605 /* For all other operators, rely on pg_operator.oprcanmerge */
1607 if (HeapTupleIsValid(tp))
1608 {
1610
1611 result = optup->oprcanmerge;
1612 ReleaseSysCache(tp);
1613 }
1614 }
1615 return result;
1616}
#define TYPECACHE_CMP_PROC
Definition typcache.h:141

References TypeCacheEntry::cmp_proc, fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, lookup_type_cache(), ObjectIdGetDatum(), ReleaseSysCache(), result, SearchSysCache1(), and TYPECACHE_CMP_PROC.

Referenced by check_mergejoinable(), and compute_semijoin_info().

◆ op_strict()

bool op_strict ( Oid  opno)
extern

Definition at line 1670 of file lsyscache.c.

1671{
1672 RegProcedure funcid = get_opcode(opno);
1673
1674 if (funcid == (RegProcedure) InvalidOid)
1675 elog(ERROR, "operator %u does not exist", opno);
1676
1677 return func_strict((Oid) funcid);
1678}
RegProcedure get_opcode(Oid opno)
Definition lsyscache.c:1478
bool func_strict(Oid funcid)
Definition lsyscache.c:1954

References elog, ERROR, func_strict(), get_opcode(), and InvalidOid.

Referenced by clause_is_strict_for(), ExecInitHashJoin(), have_partkey_equi_join(), match_clause_to_partition_key(), and operator_predicate_proof().

◆ op_volatile()

char op_volatile ( Oid  opno)
extern

Definition at line 1686 of file lsyscache.c.

1687{
1688 RegProcedure funcid = get_opcode(opno);
1689
1690 if (funcid == (RegProcedure) InvalidOid)
1691 elog(ERROR, "operator %u does not exist", opno);
1692
1693 return func_volatile((Oid) funcid);
1694}
char func_volatile(Oid funcid)
Definition lsyscache.c:1973

References elog, ERROR, func_volatile(), get_opcode(), and InvalidOid.

Referenced by lookup_proof_cache(), and match_clause_to_partition_key().

◆ type_is_collatable()

◆ type_is_enum()

bool type_is_enum ( Oid  typid)
extern

Definition at line 2873 of file lsyscache.c.

2874{
2875 return (get_typtype(typid) == TYPTYPE_ENUM);
2876}
char get_typtype(Oid typid)
Definition lsyscache.c:2824

References fb(), and get_typtype().

Referenced by check_generic_type_consistency(), enforce_generic_type_consistency(), and IsBinaryCoercibleWithCast().

◆ type_is_multirange()

◆ type_is_range()

bool type_is_range ( Oid  typid)
extern

◆ type_is_rowtype()

bool type_is_rowtype ( Oid  typid)
extern

Variable Documentation

◆ get_attavgwidth_hook

PGDLLIMPORT get_attavgwidth_hook_type get_attavgwidth_hook
extern

Definition at line 57 of file lsyscache.c.

Referenced by get_attavgwidth().