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)
 
bool get_attnotnull (Oid relid, AttrNumber 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_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
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, 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, and SearchSysCacheList1.

Referenced by query_is_distinct_for().

◆ free_attstatsslot()

void free_attstatsslot ( AttStatsSlot sslot)
extern

Definition at line 3566 of file lsyscache.c.

3567{
3568 /* The values[] array was separately palloc'd by deconstruct_array */
3569 if (sslot->values)
3570 pfree(sslot->values);
3571 /* The numbers[] array points into numbers_arr, do not pfree it */
3572 /* Free the detoasted array objects, if any */
3573 if (sslot->values_arr)
3574 pfree(sslot->values_arr);
3575 if (sslot->numbers_arr)
3576 pfree(sslot->numbers_arr);
3577}
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 2019 of file lsyscache.c.

2020{
2021 HeapTuple tp;
2022 char result;
2023
2025 if (!HeapTupleIsValid(tp))
2026 elog(ERROR, "cache lookup failed for function %u", funcid);
2027
2028 result = ((Form_pg_proc) GETSTRUCT(tp))->proparallel;
2029 ReleaseSysCache(tp);
2030 return result;
2031}
#define ERROR
Definition elog.h:39
#define elog(elevel,...)
Definition elog.h:226
#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:264
HeapTuple SearchSysCache1(SysCacheIdentifier cacheId, Datum key1)
Definition syscache.c:220

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

Referenced by max_parallel_hazard_checker(), and set_rel_consider_parallel().

◆ func_strict()

bool func_strict ( Oid  funcid)
extern

◆ func_volatile()

◆ get_array_type()

◆ get_attavgwidth()

int32 get_attavgwidth ( Oid  relid,
AttrNumber  attnum 
)
extern

Definition at line 3380 of file lsyscache.c.

3381{
3382 HeapTuple tp;
3383 int32 stawidth;
3384
3386 {
3387 stawidth = (*get_attavgwidth_hook) (relid, attnum);
3388 if (stawidth > 0)
3389 return stawidth;
3390 }
3392 ObjectIdGetDatum(relid),
3394 BoolGetDatum(false));
3395 if (HeapTupleIsValid(tp))
3396 {
3397 stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth;
3398 ReleaseSysCache(tp);
3399 if (stawidth > 0)
3400 return stawidth;
3401 }
3402 return 0;
3403}
int32_t int32
Definition c.h:614
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:240

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:230

References attnum, elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), ObjectIdGetDatum(), ReleaseSysCache(), 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:837
char * pstrdup(const char *in)
Definition mcxt.c:1781

References attnum, elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), 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_attnotnull()

bool get_attnotnull ( Oid  relid,
AttrNumber  attnum 
)
extern

Definition at line 1124 of file lsyscache.c.

1125{
1126 HeapTuple tp;
1127 bool result = false;
1128
1130 ObjectIdGetDatum(relid),
1132
1133 if (HeapTupleIsValid(tp))
1134 {
1136
1137 result = att_tup->attnotnull;
1138 ReleaseSysCache(tp);
1139 }
1140
1141 return result;
1142}

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

Referenced by var_is_nonnullable().

◆ 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:595

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

Referenced by CheckIndexCompatible(), generateClonedIndexStmt(), index_concurrently_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 3456 of file lsyscache.c.

3458{
3460 int i;
3461 Datum val;
3464 int narrayelem;
3467
3468 /* initialize *sslot properly */
3469 memset(sslot, 0, sizeof(AttStatsSlot));
3470
3471 for (i = 0; i < STATISTIC_NUM_SLOTS; i++)
3472 {
3473 if ((&stats->stakind1)[i] == reqkind &&
3474 (reqop == InvalidOid || (&stats->staop1)[i] == reqop))
3475 break;
3476 }
3477 if (i >= STATISTIC_NUM_SLOTS)
3478 return false; /* not there */
3479
3480 sslot->staop = (&stats->staop1)[i];
3481 sslot->stacoll = (&stats->stacoll1)[i];
3482
3483 if (flags & ATTSTATSSLOT_VALUES)
3484 {
3487
3488 /*
3489 * Detoast the array if needed, and in any case make a copy that's
3490 * under control of this AttStatsSlot.
3491 */
3493
3494 /*
3495 * Extract the actual array element type, and pass it back in case the
3496 * caller needs it.
3497 */
3498 sslot->valuetype = arrayelemtype = ARR_ELEMTYPE(statarray);
3499
3500 /* Need info about element type */
3503 elog(ERROR, "cache lookup failed for type %u", arrayelemtype);
3505
3506 /* Deconstruct array into Datum elements; NULLs not expected */
3509 typeForm->typlen,
3510 typeForm->typbyval,
3511 typeForm->typalign,
3512 &sslot->values, NULL, &sslot->nvalues);
3513
3514 /*
3515 * If the element type is pass-by-reference, we now have a bunch of
3516 * Datums that are pointers into the statarray, so we need to keep
3517 * that until free_attstatsslot. Otherwise, all the useful info is in
3518 * sslot->values[], so we can free the array object immediately.
3519 */
3520 if (!typeForm->typbyval)
3521 sslot->values_arr = statarray;
3522 else
3524
3526 }
3527
3528 if (flags & ATTSTATSSLOT_NUMBERS)
3529 {
3532
3533 /*
3534 * Detoast the array if needed, and in any case make a copy that's
3535 * under control of this AttStatsSlot.
3536 */
3538
3539 /*
3540 * We expect the array to be a 1-D float4 array; verify that. We don't
3541 * need to use deconstruct_array() since the array data is just going
3542 * to look like a C array of float4 values.
3543 */
3545 if (ARR_NDIM(statarray) != 1 || narrayelem <= 0 ||
3548 elog(ERROR, "stanumbers is not a 1-D float4 array");
3549
3550 /* Give caller a pointer directly into the statarray */
3551 sslot->numbers = (float4 *) ARR_DATA_PTR(statarray);
3552 sslot->nnumbers = narrayelem;
3553
3554 /* We'll free the statarray in free_attstatsslot */
3555 sslot->numbers_arr = statarray;
3556 }
3557
3558 return true;
3559}
#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:715
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:625

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(), 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 3054 of file lsyscache.c.

3055{
3056 /*
3057 * We loop to find the bottom base type in a stack of domains.
3058 */
3059 for (;;)
3060 {
3061 HeapTuple tup;
3063
3065 if (!HeapTupleIsValid(tup))
3066 break;
3068 if (typTup->typtype != TYPTYPE_DOMAIN)
3069 {
3070 /* Not a domain, so stop descending */
3071 Oid result;
3072
3073 /* This test must match get_element_type */
3075 result = typTup->typelem;
3076 else
3077 result = InvalidOid;
3079 return result;
3080 }
3081
3082 typid = typTup->typbasetype;
3084 }
3085
3086 /* Like get_element_type, silently return InvalidOid for bogus input */
3087 return InvalidOid;
3088}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), 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 1153 of file lsyscache.c.

1154{
1155 Oid oid;
1156
1160 if (!OidIsValid(oid) && !missing_ok)
1161 ereport(ERROR,
1163 errmsg("cast from type %s to type %s does not exist",
1166 return oid;
1167}
#define OidIsValid(objectId)
Definition c.h:860
int errcode(int sqlerrcode)
Definition elog.c:874
#define ereport(elevel,...)
Definition elog.h:150
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 1200 of file lsyscache.c.

1201{
1202 HeapTuple tp;
1204 bool result;
1205
1207 if (!HeapTupleIsValid(tp))
1208 elog(ERROR, "cache lookup failed for collation %u", colloid);
1210 result = colltup->collisdeterministic;
1211 ReleaseSysCache(tp);
1212 return result;
1213}
END_CATALOG_STRUCT typedef FormData_pg_collation * Form_pg_collation

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

Referenced by ATAddForeignKeyConstraint(), 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, and SearchSysCacheList1.

Referenced by create_unique_paths(), and ExecInitSubPlan().

◆ get_constraint_index()

Oid get_constraint_index ( Oid  conoid)
extern

Definition at line 1259 of file lsyscache.c.

1260{
1261 HeapTuple tp;
1262
1264 if (HeapTupleIsValid(tp))
1265 {
1267 Oid result;
1268
1269 if (contup->contype == CONSTRAINT_UNIQUE ||
1270 contup->contype == CONSTRAINT_PRIMARY ||
1271 contup->contype == CONSTRAINT_EXCLUSION)
1272 result = contup->conindid;
1273 else
1274 result = InvalidOid;
1275 ReleaseSysCache(tp);
1276 return result;
1277 }
1278 else
1279 return InvalidOid;
1280}
END_CATALOG_STRUCT typedef FormData_pg_constraint * Form_pg_constraint

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

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

◆ get_constraint_name()

char * get_constraint_name ( Oid  conoid)
extern

Definition at line 1227 of file lsyscache.c.

1228{
1229 HeapTuple tp;
1230
1232 if (HeapTupleIsValid(tp))
1233 {
1235 char *result;
1236
1237 result = pstrdup(NameStr(contup->conname));
1238 ReleaseSysCache(tp);
1239 return result;
1240 }
1241 else
1242 return NULL;
1243}

References fb(), Form_pg_constraint, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), 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 1289 of file lsyscache.c.

1290{
1291 HeapTuple tp;
1292 char contype;
1293
1295 if (!HeapTupleIsValid(tp))
1296 elog(ERROR, "cache lookup failed for constraint %u", conoid);
1297
1298 contype = ((Form_pg_constraint) GETSTRUCT(tp))->contype;
1299 ReleaseSysCache(tp);
1300
1301 return contype;
1302}

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 1312 of file lsyscache.c.

1313{
1315 char *result;
1316
1319 {
1322 }
1323 else
1324 result = NULL;
1325
1326 return result;
1327}
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(), 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(), 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{
328 Oid result = InvalidOid;
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 */
338 result = get_opfamily_member_for_cmptype(opfamily,
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(), and InvalidOid.

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

◆ get_func_leakproof()

bool get_func_leakproof ( Oid  funcid)
extern

Definition at line 2057 of file lsyscache.c.

2058{
2059 HeapTuple tp;
2060 bool result;
2061
2063 if (!HeapTupleIsValid(tp))
2064 elog(ERROR, "cache lookup failed for function %u", funcid);
2065
2066 result = ((Form_pg_proc) GETSTRUCT(tp))->proleakproof;
2067 ReleaseSysCache(tp);
2068 return result;
2069}

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

Referenced by contain_leaked_vars_checker(), contain_leaked_vars_walker(), create_agg_clause_infos(), select_equality_operator(), statext_is_compatible_clause_internal(), and statistic_proc_security_check().

◆ get_func_name()

◆ get_func_namespace()

Oid get_func_namespace ( Oid  funcid)
extern

Definition at line 1852 of file lsyscache.c.

1853{
1854 HeapTuple tp;
1855
1857 if (HeapTupleIsValid(tp))
1858 {
1860 Oid result;
1861
1862 result = functup->pronamespace;
1863 ReleaseSysCache(tp);
1864 return result;
1865 }
1866 else
1867 return InvalidOid;
1868}

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

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

◆ get_func_nargs()

int get_func_nargs ( Oid  funcid)
extern

Definition at line 1894 of file lsyscache.c.

1895{
1896 HeapTuple tp;
1897 int result;
1898
1900 if (!HeapTupleIsValid(tp))
1901 elog(ERROR, "cache lookup failed for function %u", funcid);
1902
1903 result = ((Form_pg_proc) GETSTRUCT(tp))->pronargs;
1904 ReleaseSysCache(tp);
1905 return result;
1906}
int16 pronargs
Definition pg_proc.h:83

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

◆ get_func_prokind()

char get_func_prokind ( Oid  funcid)
extern

Definition at line 2038 of file lsyscache.c.

2039{
2040 HeapTuple tp;
2041 char result;
2042
2044 if (!HeapTupleIsValid(tp))
2045 elog(ERROR, "cache lookup failed for function %u", funcid);
2046
2047 result = ((Form_pg_proc) GETSTRUCT(tp))->prokind;
2048 ReleaseSysCache(tp);
2049 return result;
2050}

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

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

◆ get_func_retset()

bool get_func_retset ( Oid  funcid)
extern

Definition at line 1962 of file lsyscache.c.

1963{
1964 HeapTuple tp;
1965 bool result;
1966
1968 if (!HeapTupleIsValid(tp))
1969 elog(ERROR, "cache lookup failed for function %u", funcid);
1970
1971 result = ((Form_pg_proc) GETSTRUCT(tp))->proretset;
1972 ReleaseSysCache(tp);
1973 return result;
1974}

References elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), 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 1916 of file lsyscache.c.

1917{
1918 HeapTuple tp;
1920 Oid result;
1921
1923 if (!HeapTupleIsValid(tp))
1924 elog(ERROR, "cache lookup failed for function %u", funcid);
1925
1927
1928 result = procstruct->prorettype;
1929 *nargs = (int) procstruct->pronargs;
1930 Assert(*nargs == procstruct->proargtypes.dim1);
1931 *argtypes = (Oid *) palloc(*nargs * sizeof(Oid));
1932 memcpy(*argtypes, procstruct->proargtypes.values, *nargs * sizeof(Oid));
1933
1934 ReleaseSysCache(tp);
1935 return result;
1936}
#define Assert(condition)
Definition c.h:945
void * palloc(Size size)
Definition mcxt.c:1387

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

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

◆ get_func_support()

RegProcedure get_func_support ( Oid  funcid)
extern

Definition at line 2078 of file lsyscache.c.

2079{
2080 HeapTuple tp;
2081
2083 if (HeapTupleIsValid(tp))
2084 {
2086 RegProcedure result;
2087
2088 result = functup->prosupport;
2089 ReleaseSysCache(tp);
2090 return result;
2091 }
2092 else
2093 return (RegProcedure) InvalidOid;
2094}
regproc RegProcedure
Definition c.h:736

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

Referenced by exec_check_rw_parameter(), find_window_run_conditions(), function_selectivity(), get_index_clause_from_support(), optimize_window_clauses(), and simplify_aggref().

◆ get_func_variadictype()

Oid get_func_variadictype ( Oid  funcid)
extern

Definition at line 1943 of file lsyscache.c.

1944{
1945 HeapTuple tp;
1946 Oid result;
1947
1949 if (!HeapTupleIsValid(tp))
1950 elog(ERROR, "cache lookup failed for function %u", funcid);
1951
1952 result = ((Form_pg_proc) GETSTRUCT(tp))->provariadic;
1953 ReleaseSysCache(tp);
1954 return result;
1955}

References elog, ERROR, fb(), Form_pg_proc, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), 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 3734 of file lsyscache.c.

3735{
3736 HeapTuple tuple;
3737 Form_pg_index rd_index;
3738 Datum datum;
3740 Oid opclass;
3741
3742 /* First we need to know the column's opclass. */
3743
3745 if (!HeapTupleIsValid(tuple))
3746 return InvalidOid;
3747
3748 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3749
3750 /* caller is supposed to guarantee this */
3751 Assert(attno > 0 && attno <= rd_index->indnatts);
3752
3753 /* Non-key attributes don't have an opclass */
3754 if (attno > rd_index->indnkeyatts)
3755 {
3756 ReleaseSysCache(tuple);
3757 return InvalidOid;
3758 }
3759
3761 indclass = ((oidvector *) DatumGetPointer(datum));
3762
3764 opclass = indclass->values[attno - 1];
3765
3766 ReleaseSysCache(tuple);
3767
3768 return opclass;
3769}
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:817

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 3823 of file lsyscache.c.

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

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 3777 of file lsyscache.c.

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

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

Referenced by RememberReplicaIdentityForRebuilding().

◆ get_index_isvalid()

bool get_index_isvalid ( Oid  index_oid)
extern

Definition at line 3800 of file lsyscache.c.

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

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 1333 of file lsyscache.c.

1334{
1335 HeapTuple tp;
1336
1338 if (HeapTupleIsValid(tp))
1339 {
1341 char *result;
1342
1343 result = pstrdup(NameStr(lantup->lanname));
1344 ReleaseSysCache(tp);
1345 return result;
1346 }
1347
1348 if (!missing_ok)
1349 elog(ERROR, "cache lookup failed for language %u",
1350 langoid);
1351 return NULL;
1352}
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(), 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, 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()

Oid get_multirange_range ( Oid  multirangeOid)
extern

◆ get_namespace_name()

char * get_namespace_name ( Oid  nspid)
extern

Definition at line 3588 of file lsyscache.c.

3589{
3590 HeapTuple tp;
3591
3593 if (HeapTupleIsValid(tp))
3594 {
3596 char *result;
3597
3598 result = pstrdup(NameStr(nsptup->nspname));
3599 ReleaseSysCache(tp);
3600 return result;
3601 }
3602 else
3603 return NULL;
3604}
int nspid
END_CATALOG_STRUCT typedef FormData_pg_namespace * Form_pg_namespace

References fb(), Form_pg_namespace, GETSTRUCT(), HeapTupleIsValid, NameStr, nspid, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), 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(), 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_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, 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;
705 result = lappend(result, thisresult);
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;
750 result = lappend(result, thisresult);
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:1753

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, 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(), and MJExamineQuals().

◆ 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(), 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 1553 of file lsyscache.c.

1554{
1555 HeapTuple tp;
1556
1558 if (HeapTupleIsValid(tp))
1559 {
1561 Oid result;
1562
1563 result = optup->oprresult;
1564 ReleaseSysCache(tp);
1565 return result;
1566 }
1567 else
1568 return InvalidOid;
1569}

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

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

◆ get_opclass_family()

Oid get_opclass_family ( Oid  opclass)
extern

Definition at line 1362 of file lsyscache.c.

1363{
1364 HeapTuple tp;
1366 Oid result;
1367
1368 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1369 if (!HeapTupleIsValid(tp))
1370 elog(ERROR, "cache lookup failed for opclass %u", opclass);
1372
1373 result = cla_tup->opcfamily;
1374 ReleaseSysCache(tp);
1375 return result;
1376}
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(), 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

Definition at line 1384 of file lsyscache.c.

1385{
1386 HeapTuple tp;
1388 Oid result;
1389
1390 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1391 if (!HeapTupleIsValid(tp))
1392 elog(ERROR, "cache lookup failed for opclass %u", opclass);
1394
1395 result = cla_tup->opcintype;
1396 ReleaseSysCache(tp);
1397 return result;
1398}

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

Referenced by btadjustmembers(), build_replindex_scan_key(), CheckIndexCompatible(), findRangeSubOpclass(), get_rule_expr(), hashadjustmembers(), infer_collation_opclass_match(), load_rangetype_info(), and lookup_type_cache().

◆ get_opclass_method()

Oid get_opclass_method ( Oid  opclass)
extern

Definition at line 1432 of file lsyscache.c.

1433{
1434 HeapTuple tp;
1436 Oid result;
1437
1438 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1439 if (!HeapTupleIsValid(tp))
1440 elog(ERROR, "cache lookup failed for opclass %u", opclass);
1442
1443 result = cla_tup->opcmethod;
1444 ReleaseSysCache(tp);
1445 return result;
1446}

References elog, ERROR, fb(), Form_pg_opclass, GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), 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 1407 of file lsyscache.c.

1408{
1409 HeapTuple tp;
1411
1412 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1413 if (!HeapTupleIsValid(tp))
1414 return false;
1415
1417
1418 *opfamily = cla_tup->opcfamily;
1419 *opcintype = cla_tup->opcintype;
1420
1421 ReleaseSysCache(tp);
1422
1423 return true;
1424}

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

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

◆ get_opcode()

RegProcedure get_opcode ( Oid  opno)
extern

Definition at line 1505 of file lsyscache.c.

1506{
1507 HeapTuple tp;
1508
1510 if (HeapTupleIsValid(tp))
1511 {
1513 RegProcedure result;
1514
1515 result = optup->oprcode;
1516 ReleaseSysCache(tp);
1517 return result;
1518 }
1519 else
1520 return (RegProcedure) InvalidOid;
1521}

References fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), 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(), 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(), scalarineqsel(), select_equality_operator(), set_opfuncid(), set_sa_opfuncid(), statext_is_compatible_clause_internal(), std_typanalyze(), 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:1456
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 1456 of file lsyscache.c.

1457{
1458 HeapTuple tp;
1460 Oid result;
1461
1463 if (!HeapTupleIsValid(tp))
1464 elog(ERROR, "cache lookup failed for operator family %u", opfid);
1466
1467 result = opfform->opfmethod;
1468 ReleaseSysCache(tp);
1469 return result;
1470}
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(), 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 1473 of file lsyscache.c.

1474{
1475 HeapTuple tup;
1476 char *opfname;
1478
1480
1481 if (!HeapTupleIsValid(tup))
1482 {
1483 if (!missing_ok)
1484 elog(ERROR, "cache lookup failed for operator family %u", opfid);
1485 return NULL;
1486 }
1487
1489 opfname = pstrdup(NameStr(opfform->opfname));
1490
1492
1493 return opfname;
1494}

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 1530 of file lsyscache.c.

1531{
1532 HeapTuple tp;
1533
1535 if (HeapTupleIsValid(tp))
1536 {
1538 char *result;
1539
1540 result = pstrdup(NameStr(optup->oprname));
1541 ReleaseSysCache(tp);
1542 return result;
1543 }
1544 else
1545 return NULL;
1546}

References fb(), Form_pg_operator, GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), 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 1801 of file lsyscache.c.

1802{
1803 HeapTuple tp;
1804
1806 if (HeapTupleIsValid(tp))
1807 {
1809 RegProcedure result;
1810
1811 result = optup->oprjoin;
1812 ReleaseSysCache(tp);
1813 return result;
1814 }
1815 else
1816 return (RegProcedure) InvalidOid;
1817}

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

Referenced by join_selectivity(), and scalararraysel().

◆ get_oprrest()

RegProcedure get_oprrest ( Oid  opno)
extern

◆ 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{
366 Oid result = InvalidOid;
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;
396 result = get_opfamily_member_for_cmptype(aform->amopfamily,
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, 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, 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 3033 of file lsyscache.c.

3034{
3035 Oid array_type = get_array_type(typid);
3036
3037 if (OidIsValid(array_type))
3038 return array_type;
3039 if (OidIsValid(get_element_type(typid)))
3040 return typid;
3041 return InvalidOid;
3042}
Oid get_element_type(Oid typid)
Definition lsyscache.c:2981
Oid get_array_type(Oid typid)
Definition lsyscache.c:3009

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 3941 of file lsyscache.c.

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

References elog, ERROR, fb(), Form_pg_propgraph_label, GETSTRUCT(), NameStr, 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 3959 of file lsyscache.c.

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

References elog, ERROR, fb(), Form_pg_propgraph_property, GETSTRUCT(), NameStr, 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 3867 of file lsyscache.c.

3868{
3869 HeapTuple tup;
3870 char *pubname;
3872
3874
3875 if (!HeapTupleIsValid(tup))
3876 {
3877 if (!missing_ok)
3878 elog(ERROR, "cache lookup failed for publication %u", pubid);
3879 return NULL;
3880 }
3881
3883 pubname = pstrdup(NameStr(pubform->pubname));
3884
3886
3887 return pubname;
3888}
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 3847 of file lsyscache.c.

3848{
3849 Oid oid;
3850
3852 CStringGetDatum(pubname));
3853 if (!OidIsValid(oid) && !missing_ok)
3854 ereport(ERROR,
3856 errmsg("publication \"%s\" does not exist", pubname)));
3857 return oid;
3858}
static Datum CStringGetDatum(const char *X)
Definition postgres.h:370
#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 3655 of file lsyscache.c.

3656{
3657 HeapTuple tp;
3658
3660 if (HeapTupleIsValid(tp))
3661 {
3663 Oid result;
3664
3665 result = rngtup->rngcollation;
3666 ReleaseSysCache(tp);
3667 return result;
3668 }
3669 else
3670 return InvalidOid;
3671}

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

Referenced by CheckAttributeType().

◆ get_range_multirange()

Oid get_range_multirange ( Oid  rangeOid)
extern

Definition at line 3680 of file lsyscache.c.

3681{
3682 HeapTuple tp;
3683
3685 if (HeapTupleIsValid(tp))
3686 {
3688 Oid result;
3689
3690 result = rngtup->rngmultitypid;
3691 ReleaseSysCache(tp);
3692 return result;
3693 }
3694 else
3695 return InvalidOid;
3696}

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

Referenced by AlterTypeOwnerInternal(), enforce_generic_type_consistency(), ExecAlterExtensionContentsRecurse(), and resolve_anymultirange_from_others().

◆ get_range_subtype()

Oid get_range_subtype ( Oid  rangeOid)
extern

Definition at line 3629 of file lsyscache.c.

3630{
3631 HeapTuple tp;
3632
3634 if (HeapTupleIsValid(tp))
3635 {
3637 Oid result;
3638
3639 result = rngtup->rngsubtype;
3640 ReleaseSysCache(tp);
3641 return result;
3642 }
3643 else
3644 return InvalidOid;
3645}

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

Referenced by check_generic_type_consistency(), CheckAttributeType(), enforce_generic_type_consistency(), json_check_mutability(), and resolve_anyelement_from_others().

◆ get_rel_name()

char * get_rel_name ( Oid  relid)
extern

Definition at line 2148 of file lsyscache.c.

2149{
2150 HeapTuple tp;
2151
2153 if (HeapTupleIsValid(tp))
2154 {
2156 char *result;
2157
2158 result = pstrdup(NameStr(reltup->relname));
2159 ReleaseSysCache(tp);
2160 return result;
2161 }
2162 else
2163 return NULL;
2164}
FormData_pg_class * Form_pg_class
Definition pg_class.h:160

References fb(), GETSTRUCT(), HeapTupleIsValid, NameStr, ObjectIdGetDatum(), pstrdup(), ReleaseSysCache(), 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(), 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(), 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(), 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(), 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 2298 of file lsyscache.c.

2299{
2300 HeapTuple tp;
2302 char result;
2303
2305 if (!HeapTupleIsValid(tp))
2306 elog(ERROR, "cache lookup failed for relation %u", relid);
2308 result = reltup->relpersistence;
2309 ReleaseSysCache(tp);
2310
2311 return result;
2312}

References elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), 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 2320 of file lsyscache.c.

2321{
2322 HeapTuple tp;
2324 Oid result;
2325
2327 if (!HeapTupleIsValid(tp))
2328 elog(ERROR, "cache lookup failed for relation %u", relid);
2330 result = reltup->relam;
2331 ReleaseSysCache(tp);
2332
2333 return result;
2334}

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

Referenced by DefineRelation().

◆ get_rel_relispartition()

bool get_rel_relispartition ( Oid  relid)
extern

Definition at line 2247 of file lsyscache.c.

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

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

Referenced by check_rel_can_be_partition(), filter_partitions(), get_partition_qual_relid(), get_rel_sync_entry(), and index_concurrently_swap().

◆ get_rel_relkind()

char get_rel_relkind ( Oid  relid)
extern

Definition at line 2223 of file lsyscache.c.

2224{
2225 HeapTuple tp;
2226
2228 if (HeapTupleIsValid(tp))
2229 {
2231 char result;
2232
2233 result = reltup->relkind;
2234 ReleaseSysCache(tp);
2235 return result;
2236 }
2237 else
2238 return '\0';
2239}

References fb(), GETSTRUCT(), HeapTupleIsValid, ObjectIdGetDatum(), ReleaseSysCache(), 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(), 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(), 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 2274 of file lsyscache.c.

2275{
2276 HeapTuple tp;
2277
2279 if (HeapTupleIsValid(tp))
2280 {
2282 Oid result;
2283
2284 result = reltup->reltablespace;
2285 ReleaseSysCache(tp);
2286 return result;
2287 }
2288 else
2289 return InvalidOid;
2290}

References fb(), GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), 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

Definition at line 2199 of file lsyscache.c.

2200{
2201 HeapTuple tp;
2202
2204 if (HeapTupleIsValid(tp))
2205 {
2207 Oid result;
2208
2209 result = reltup->reltype;
2210 ReleaseSysCache(tp);
2211 return result;
2212 }
2213 else
2214 return InvalidOid;
2215}

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

Referenced by ExecAlterExtensionContentsRecurse(), get_tupdesc_for_join_scan_tuples(), import_expressions(), makeWholeRowVar(), plpgsql_parse_cwordrowtype(), plpgsql_parse_wordrowtype(), and serialize_expr_stats().

◆ get_relname_relid()

◆ get_subscription_name()

char * get_subscription_name ( Oid  subid,
bool  missing_ok 
)
extern

Definition at line 3917 of file lsyscache.c.

3918{
3919 HeapTuple tup;
3920 char *subname;
3922
3924
3925 if (!HeapTupleIsValid(tup))
3926 {
3927 if (!missing_ok)
3928 elog(ERROR, "cache lookup failed for subscription %u", subid);
3929 return NULL;
3930 }
3931
3933 subname = pstrdup(NameStr(subform->subname));
3934
3936
3937 return subname;
3938}
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 3897 of file lsyscache.c.

3898{
3899 Oid oid;
3900
3903 if (!OidIsValid(oid) && !missing_ok)
3904 ereport(ERROR,
3906 errmsg("subscription \"%s\" does not exist", subname)));
3907 return oid;
3908}
Oid MyDatabaseId
Definition globals.c:94

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 2340 of file lsyscache.c.

2341{
2342 HeapTuple tup;
2343
2344 if (!list_member_oid(trftypes, typid))
2345 return InvalidOid;
2346
2348 ObjectIdGetDatum(langid));
2349 if (HeapTupleIsValid(tup))
2350 {
2351 Oid funcid;
2352
2353 funcid = ((Form_pg_transform) GETSTRUCT(tup))->trffromsql;
2355 return funcid;
2356 }
2357 else
2358 return InvalidOid;
2359}
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 2362 of file lsyscache.c.

2363{
2364 HeapTuple tup;
2365
2366 if (!list_member_oid(trftypes, typid))
2367 return InvalidOid;
2368
2370 ObjectIdGetDatum(langid));
2371 if (HeapTupleIsValid(tup))
2372 {
2373 Oid funcid;
2374
2375 funcid = ((Form_pg_transform) GETSTRUCT(tup))->trftosql;
2377 return funcid;
2378 }
2379 else
2380 return InvalidOid;
2381}

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 2953 of file lsyscache.c.

2954{
2955 HeapTuple tp;
2956
2958 if (HeapTupleIsValid(tp))
2959 {
2961 Oid result;
2962
2963 result = typtup->typrelid;
2964 ReleaseSysCache(tp);
2965 return result;
2966 }
2967 else
2968 return InvalidOid;
2969}

References fb(), Form_pg_type, GETSTRUCT(), HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), ReleaseSysCache(), 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 2800 of file lsyscache.c.

2801{
2802 int typlen = get_typlen(typid);
2804
2805 /*
2806 * Easy if it's a fixed-width type
2807 */
2808 if (typlen > 0)
2809 return typlen;
2810
2811 /*
2812 * type_maximum_size knows the encoding of typmod for some datatypes;
2813 * don't duplicate that knowledge here.
2814 */
2815 maxwidth = type_maximum_size(typid, typmod);
2816 if (maxwidth > 0)
2817 {
2818 /*
2819 * For BPCHAR, the max width is also the only width. Otherwise we
2820 * need to guess about the typical data width given the max. A sliding
2821 * scale for percentage of max width seems reasonable.
2822 */
2823 if (typid == BPCHAROID)
2824 return maxwidth;
2825 if (maxwidth <= 32)
2826 return maxwidth; /* assume full width */
2827 if (maxwidth < 1000)
2828 return 32 + (maxwidth - 32) / 2; /* assume 50% */
2829
2830 /*
2831 * Beyond 1000, assume we're looking at something like
2832 * "varchar(10000)" where the limit isn't actually reached often, and
2833 * use a fixed estimate.
2834 */
2835 return 32 + (1000 - 32) / 2;
2836 }
2837
2838 /*
2839 * Oops, we have no idea ... wild guess time.
2840 */
2841 return 32;
2842}
int32 type_maximum_size(Oid type_oid, int32 typemod)
int16 get_typlen(Oid typid)
Definition lsyscache.c:2417

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 2442 of file lsyscache.c.

2443{
2444 HeapTuple tp;
2445
2447 if (HeapTupleIsValid(tp))
2448 {
2450 bool result;
2451
2452 result = typtup->typbyval;
2453 ReleaseSysCache(tp);
2454 return result;
2455 }
2456 else
2457 return false;
2458}

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

Referenced by brin_range_deserialize(), and brin_range_serialize().

◆ get_typcollation()

◆ get_typdefault()

Node * get_typdefault ( Oid  typid)
extern

Definition at line 2670 of file lsyscache.c.

2671{
2674 Datum datum;
2675 bool isNull;
2676 Node *expr;
2677
2680 elog(ERROR, "cache lookup failed for type %u", typid);
2682
2683 /*
2684 * typdefault and typdefaultbin are potentially null, so don't try to
2685 * access 'em as struct fields. Must do it the hard way with
2686 * SysCacheGetAttr.
2687 */
2688 datum = SysCacheGetAttr(TYPEOID,
2689 typeTuple,
2691 &isNull);
2692
2693 if (!isNull)
2694 {
2695 /* We have an expression default */
2696 expr = stringToNode(TextDatumGetCString(datum));
2697 }
2698 else
2699 {
2700 /* Perhaps we have a plain literal default */
2701 datum = SysCacheGetAttr(TYPEOID,
2702 typeTuple,
2704 &isNull);
2705
2706 if (!isNull)
2707 {
2708 char *strDefaultVal;
2709
2710 /* Convert text datum to C string */
2712 /* Convert C string to a value of the given type */
2713 datum = OidInputFunctionCall(type->typinput, strDefaultVal,
2715 /* Build a Const node containing the value */
2716 expr = (Node *) makeConst(typid,
2717 -1,
2718 type->typcollation,
2719 type->typlen,
2720 datum,
2721 false,
2722 type->typbyval);
2724 }
2725 else
2726 {
2727 /* No default */
2728 expr = NULL;
2729 }
2730 }
2731
2733
2734 return expr;
2735}
#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:2523
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 2545 of file lsyscache.c.

2553{
2556
2557 /*
2558 * In bootstrap mode, pass it off to bootstrap.c. This hack allows us to
2559 * use array_in and array_out during bootstrap.
2560 */
2562 {
2563 Oid typinput;
2564 Oid typoutput;
2565 Oid typcollation;
2566
2568 typlen,
2569 typbyval,
2570 typalign,
2571 typdelim,
2572 typioparam,
2573 &typinput,
2574 &typoutput,
2575 &typcollation);
2576 switch (which_func)
2577 {
2578 case IOFunc_input:
2579 *func = typinput;
2580 break;
2581 case IOFunc_output:
2582 *func = typoutput;
2583 break;
2584 default:
2585 elog(ERROR, "binary I/O not supported during bootstrap");
2586 break;
2587 }
2588 return;
2589 }
2590
2593 elog(ERROR, "cache lookup failed for type %u", typid);
2595
2596 *typlen = typeStruct->typlen;
2597 *typbyval = typeStruct->typbyval;
2598 *typalign = typeStruct->typalign;
2599 *typdelim = typeStruct->typdelim;
2600 *typioparam = getTypeIOParam(typeTuple);
2601 switch (which_func)
2602 {
2603 case IOFunc_input:
2604 *func = typeStruct->typinput;
2605 break;
2606 case IOFunc_output:
2607 *func = typeStruct->typoutput;
2608 break;
2609 case IOFunc_receive:
2610 *func = typeStruct->typreceive;
2611 break;
2612 case IOFunc_send:
2613 *func = typeStruct->typsend;
2614 break;
2615 }
2617}
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:1004
#define IsBootstrapProcessingMode()
Definition miscadmin.h:477
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 2393 of file lsyscache.c.

2394{
2395 HeapTuple tp;
2396
2398 if (HeapTupleIsValid(tp))
2399 {
2401 bool result;
2402
2403 result = typtup->typisdefined;
2404 ReleaseSysCache(tp);
2405 return result;
2406 }
2407 else
2408 return false;
2409}

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

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

◆ get_typlen()

int16 get_typlen ( Oid  typid)
extern

◆ get_typlenbyval()

◆ get_typlenbyvalalign()

◆ get_typmodin()

Oid get_typmodin ( Oid  typid)
extern

Definition at line 3228 of file lsyscache.c.

3229{
3230 HeapTuple tp;
3231
3233 if (HeapTupleIsValid(tp))
3234 {
3236 Oid result;
3237
3238 result = typtup->typmodin;
3239 ReleaseSysCache(tp);
3240 return result;
3241 }
3242 else
3243 return InvalidOid;
3244}

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

◆ get_typstorage()

char get_typstorage ( Oid  typid)
extern

Definition at line 2641 of file lsyscache.c.

2642{
2643 HeapTuple tp;
2644
2646 if (HeapTupleIsValid(tp))
2647 {
2649 char result;
2650
2651 result = typtup->typstorage;
2652 ReleaseSysCache(tp);
2653 return result;
2654 }
2655 else
2656 return TYPSTORAGE_PLAIN;
2657}

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

Referenced by GetAttributeStorage().

◆ get_typsubscript()

RegProcedure get_typsubscript ( Oid  typid,
Oid typelemp 
)
extern

Definition at line 3319 of file lsyscache.c.

3320{
3321 HeapTuple tp;
3322
3324 if (HeapTupleIsValid(tp))
3325 {
3327 RegProcedure handler = typform->typsubscript;
3328
3329 if (typelemp)
3330 *typelemp = typform->typelem;
3331 ReleaseSysCache(tp);
3332 return handler;
3333 }
3334 else
3335 {
3336 if (typelemp)
3338 return InvalidOid;
3339 }
3340}

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 2760 of file lsyscache.c.

2761{
2762 /*
2763 * We loop to find the bottom base type in a stack of domains.
2764 */
2765 for (;;)
2766 {
2767 HeapTuple tup;
2769
2771 if (!HeapTupleIsValid(tup))
2772 elog(ERROR, "cache lookup failed for type %u", typid);
2774 if (typTup->typtype != TYPTYPE_DOMAIN)
2775 {
2776 /* Not a domain, so done */
2778 break;
2779 }
2780
2781 Assert(*typmod == -1);
2782 typid = typTup->typbasetype;
2783 *typmod = typTup->typtypmod;
2784
2786 }
2787
2788 return typid;
2789}

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 3352 of file lsyscache.c.

3353{
3354 RegProcedure typsubscript = get_typsubscript(typid, typelemp);
3355
3356 if (!OidIsValid(typsubscript))
3357 return NULL;
3358
3359 return (const struct SubscriptRoutines *)
3360 DatumGetPointer(OidFunctionCall0(typsubscript));
3361}
#define OidFunctionCall0(functionId)
Definition fmgr.h:720
RegProcedure get_typsubscript(Oid typid, Oid *typelemp)
Definition lsyscache.c:3319

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 3162 of file lsyscache.c.

3163{
3166
3169 elog(ERROR, "cache lookup failed for type %u", type);
3171
3172 if (!pt->typisdefined)
3173 ereport(ERROR,
3175 errmsg("type %s is only a shell",
3176 format_type_be(type))));
3177 if (!OidIsValid(pt->typreceive))
3178 ereport(ERROR,
3180 errmsg("no binary input function available for type %s",
3181 format_type_be(type))));
3182
3183 *typReceive = pt->typreceive;
3185
3187}

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 3195 of file lsyscache.c.

3196{
3199
3202 elog(ERROR, "cache lookup failed for type %u", type);
3204
3205 if (!pt->typisdefined)
3206 ereport(ERROR,
3208 errmsg("type %s is only a shell",
3209 format_type_be(type))));
3210 if (!OidIsValid(pt->typsend))
3211 ereport(ERROR,
3213 errmsg("no binary output function available for type %s",
3214 format_type_be(type))));
3215
3216 *typSend = pt->typsend;
3217 *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
3218
3220}

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 3096 of file lsyscache.c.

3097{
3100
3103 elog(ERROR, "cache lookup failed for type %u", type);
3105
3106 if (!pt->typisdefined)
3107 ereport(ERROR,
3109 errmsg("type %s is only a shell",
3110 format_type_be(type))));
3111 if (!OidIsValid(pt->typinput))
3112 ereport(ERROR,
3114 errmsg("no input function available for type %s",
3115 format_type_be(type))));
3116
3117 *typInput = pt->typinput;
3119
3121}

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(), and TupleDescGetAttInMetadata().

◆ getTypeIOParam()

Oid getTypeIOParam ( HeapTuple  typeTuple)
extern

Definition at line 2523 of file lsyscache.c.

2524{
2526
2527 /*
2528 * Array types get their typelem as parameter; everybody else gets their
2529 * own type OID as parameter.
2530 */
2531 if (OidIsValid(typeStruct->typelem))
2532 return typeStruct->typelem;
2533 else
2534 return typeStruct->oid;
2535}

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 3129 of file lsyscache.c.

3130{
3133
3136 elog(ERROR, "cache lookup failed for type %u", type);
3138
3139 if (!pt->typisdefined)
3140 ereport(ERROR,
3142 errmsg("type %s is only a shell",
3143 format_type_be(type))));
3144 if (!OidIsValid(pt->typoutput))
3145 ereport(ERROR,
3147 errmsg("no output function available for type %s",
3148 format_type_be(type))));
3149
3150 *typOutput = pt->typoutput;
3151 *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
3152
3154}

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 1657 of file lsyscache.c.

1658{
1659 bool result = false;
1660 HeapTuple tp;
1661 TypeCacheEntry *typentry;
1662
1663 /* As in op_mergejoinable, let the typcache handle the hard cases */
1664 if (opno == ARRAY_EQ_OP)
1665 {
1666 typentry = lookup_type_cache(inputtype, TYPECACHE_HASH_PROC);
1667 if (typentry->hash_proc == F_HASH_ARRAY)
1668 result = true;
1669 }
1670 else if (opno == RECORD_EQ_OP)
1671 {
1672 typentry = lookup_type_cache(inputtype, TYPECACHE_HASH_PROC);
1673 if (typentry->hash_proc == F_HASH_RECORD)
1674 result = true;
1675 }
1676 else
1677 {
1678 /* For all other operators, rely on pg_operator.oprcanhash */
1680 if (HeapTupleIsValid(tp))
1681 {
1683
1684 result = optup->oprcanhash;
1685 ReleaseSysCache(tp);
1686 }
1687 }
1688 return result;
1689}
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(), 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 1578 of file lsyscache.c.

1579{
1580 HeapTuple tp;
1582
1584 if (!HeapTupleIsValid(tp)) /* shouldn't happen */
1585 elog(ERROR, "cache lookup failed for operator %u", opno);
1587 *lefttype = optup->oprleft;
1588 *righttype = optup->oprright;
1589 ReleaseSysCache(tp);
1590}

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, and SearchSysCacheList1.

Referenced by sublink_testexpr_is_not_nullable().

◆ op_mergejoinable()

bool op_mergejoinable ( Oid  opno,
Oid  inputtype 
)
extern

Definition at line 1606 of file lsyscache.c.

1607{
1608 bool result = false;
1609 HeapTuple tp;
1610 TypeCacheEntry *typentry;
1611
1612 /*
1613 * For array_eq or record_eq, we can sort if the element or field types
1614 * are all sortable. We could implement all the checks for that here, but
1615 * the typcache already does that and caches the results too, so let's
1616 * rely on the typcache.
1617 */
1618 if (opno == ARRAY_EQ_OP)
1619 {
1620 typentry = lookup_type_cache(inputtype, TYPECACHE_CMP_PROC);
1621 if (typentry->cmp_proc == F_BTARRAYCMP)
1622 result = true;
1623 }
1624 else if (opno == RECORD_EQ_OP)
1625 {
1626 typentry = lookup_type_cache(inputtype, TYPECACHE_CMP_PROC);
1627 if (typentry->cmp_proc == F_BTRECORDCMP)
1628 result = true;
1629 }
1630 else
1631 {
1632 /* For all other operators, rely on pg_operator.oprcanmerge */
1634 if (HeapTupleIsValid(tp))
1635 {
1637
1638 result = optup->oprcanmerge;
1639 ReleaseSysCache(tp);
1640 }
1641 }
1642 return result;
1643}
#define TYPECACHE_CMP_PROC
Definition typcache.h:141

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

Referenced by check_mergejoinable(), and compute_semijoin_info().

◆ op_strict()

bool op_strict ( Oid  opno)
extern

Definition at line 1697 of file lsyscache.c.

1698{
1699 RegProcedure funcid = get_opcode(opno);
1700
1701 if (funcid == (RegProcedure) InvalidOid)
1702 elog(ERROR, "operator %u does not exist", opno);
1703
1704 return func_strict((Oid) funcid);
1705}
RegProcedure get_opcode(Oid opno)
Definition lsyscache.c:1505
bool func_strict(Oid funcid)
Definition lsyscache.c:1981

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 1713 of file lsyscache.c.

1714{
1715 RegProcedure funcid = get_opcode(opno);
1716
1717 if (funcid == (RegProcedure) InvalidOid)
1718 elog(ERROR, "operator %u does not exist", opno);
1719
1720 return func_volatile((Oid) funcid);
1721}
char func_volatile(Oid funcid)
Definition lsyscache.c:2000

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 2900 of file lsyscache.c.

2901{
2902 return (get_typtype(typid) == TYPTYPE_ENUM);
2903}
char get_typtype(Oid typid)
Definition lsyscache.c:2851

References fb(), and get_typtype().

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

◆ type_is_multirange()

bool type_is_multirange ( Oid  typid)
extern

◆ 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().