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)
 
Oid get_opfamily_proc (Oid opfamily, Oid lefttype, Oid righttype, int16 procnum)
 
charget_attname (Oid relid, AttrNumber attnum, bool missing_ok)
 
AttrNumber get_attnum (Oid relid, const char *attname)
 
char get_attgenerated (Oid relid, AttrNumber attnum)
 
Oid get_atttype (Oid relid, AttrNumber attnum)
 
void get_atttypetypmodcoll (Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid)
 
Datum get_attoptions (Oid relid, int16 attnum)
 
Oid get_cast_oid (Oid sourcetypeid, Oid targettypeid, bool missing_ok)
 
charget_collation_name (Oid colloid)
 
bool get_collation_isdeterministic (Oid colloid)
 
charget_constraint_name (Oid conoid)
 
Oid get_constraint_index (Oid conoid)
 
char get_constraint_type (Oid conoid)
 
charget_database_name (Oid dbid)
 
charget_language_name (Oid langoid, bool missing_ok)
 
Oid get_opclass_family (Oid opclass)
 
Oid get_opclass_input_type (Oid opclass)
 
bool get_opclass_opfamily_and_input_type (Oid opclass, Oid *opfamily, Oid *opcintype)
 
Oid get_opclass_method (Oid opclass)
 
Oid get_opfamily_method (Oid opfid)
 
charget_opfamily_name (Oid opfid, bool missing_ok)
 
RegProcedure get_opcode (Oid opno)
 
charget_opname (Oid opno)
 
Oid get_op_rettype (Oid opno)
 
void op_input_types (Oid opno, Oid *lefttype, Oid *righttype)
 
bool op_mergejoinable (Oid opno, Oid inputtype)
 
bool op_hashjoinable (Oid opno, Oid inputtype)
 
bool op_strict (Oid opno)
 
char op_volatile (Oid opno)
 
Oid get_commutator (Oid opno)
 
Oid get_negator (Oid opno)
 
RegProcedure get_oprrest (Oid opno)
 
RegProcedure get_oprjoin (Oid opno)
 
charget_func_name (Oid funcid)
 
Oid get_func_namespace (Oid funcid)
 
Oid get_func_rettype (Oid funcid)
 
int get_func_nargs (Oid funcid)
 
Oid get_func_signature (Oid funcid, Oid **argtypes, int *nargs)
 
Oid get_func_variadictype (Oid funcid)
 
bool get_func_retset (Oid funcid)
 
bool func_strict (Oid funcid)
 
char func_volatile (Oid funcid)
 
char func_parallel (Oid funcid)
 
char get_func_prokind (Oid funcid)
 
bool get_func_leakproof (Oid funcid)
 
RegProcedure get_func_support (Oid funcid)
 
Oid get_relname_relid (const char *relname, Oid relnamespace)
 
charget_rel_name (Oid relid)
 
Oid get_rel_namespace (Oid relid)
 
Oid get_rel_type_id (Oid relid)
 
char get_rel_relkind (Oid relid)
 
bool get_rel_relispartition (Oid relid)
 
Oid get_rel_tablespace (Oid relid)
 
char get_rel_persistence (Oid relid)
 
Oid get_rel_relam (Oid relid)
 
Oid get_transform_fromsql (Oid typid, Oid langid, List *trftypes)
 
Oid get_transform_tosql (Oid typid, Oid langid, List *trftypes)
 
bool get_typisdefined (Oid typid)
 
int16 get_typlen (Oid typid)
 
bool get_typbyval (Oid typid)
 
void get_typlenbyval (Oid typid, int16 *typlen, bool *typbyval)
 
void get_typlenbyvalalign (Oid typid, int16 *typlen, bool *typbyval, char *typalign)
 
Oid getTypeIOParam (HeapTuple typeTuple)
 
void get_type_io_data (Oid typid, IOFuncSelector which_func, int16 *typlen, bool *typbyval, char *typalign, char *typdelim, Oid *typioparam, Oid *func)
 
char get_typstorage (Oid typid)
 
Nodeget_typdefault (Oid typid)
 
char get_typtype (Oid typid)
 
bool type_is_rowtype (Oid typid)
 
bool type_is_enum (Oid typid)
 
bool type_is_range (Oid typid)
 
bool type_is_multirange (Oid typid)
 
void get_type_category_preferred (Oid typid, char *typcategory, bool *typispreferred)
 
Oid get_typ_typrelid (Oid typid)
 
Oid get_element_type (Oid typid)
 
Oid get_array_type (Oid typid)
 
Oid get_promoted_array_type (Oid typid)
 
Oid get_base_element_type (Oid typid)
 
void getTypeInputInfo (Oid type, Oid *typInput, Oid *typIOParam)
 
void getTypeOutputInfo (Oid type, Oid *typOutput, bool *typIsVarlena)
 
void getTypeBinaryInputInfo (Oid type, Oid *typReceive, Oid *typIOParam)
 
void getTypeBinaryOutputInfo (Oid type, Oid *typSend, bool *typIsVarlena)
 
Oid get_typmodin (Oid typid)
 
Oid get_typcollation (Oid typid)
 
bool type_is_collatable (Oid typid)
 
RegProcedure get_typsubscript (Oid typid, Oid *typelemp)
 
const SubscriptRoutinesgetSubscriptingRoutines (Oid typid, Oid *typelemp)
 
Oid getBaseType (Oid typid)
 
Oid getBaseTypeAndTypmod (Oid typid, int32 *typmod)
 
int32 get_typavgwidth (Oid typid, int32 typmod)
 
int32 get_attavgwidth (Oid relid, AttrNumber attnum)
 
bool get_attstatsslot (AttStatsSlot *sslot, HeapTuple statstuple, int reqkind, Oid reqop, int flags)
 
void free_attstatsslot (AttStatsSlot *sslot)
 
charget_namespace_name (Oid nspid)
 
charget_namespace_name_or_temp (Oid nspid)
 
Oid get_range_subtype (Oid rangeOid)
 
Oid get_range_collation (Oid rangeOid)
 
Oid get_range_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)
 

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 214 of file lsyscache.h.

◆ type_is_array_domain

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

Definition at line 216 of file lsyscache.h.

◆ TypeIsToastable

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

Definition at line 218 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 823 of file lsyscache.c.

824{
825 bool result;
827 int i;
828
829 /* Easy if they're the same operator */
830 if (opno1 == opno2)
831 return true;
832
833 /*
834 * We search through all the pg_amop entries for opno1.
835 */
837
838 result = false;
839 for (i = 0; i < catlist->n_members; i++)
840 {
841 HeapTuple op_tuple = &catlist->members[i]->tuple;
843
844 /*
845 * op_in_opfamily() is cheaper than GetIndexAmRoutineByAmId(), so
846 * check it first
847 */
848 if (op_in_opfamily(opno2, op_form->amopfamily) &&
850 {
851 result = true;
852 break;
853 }
854 }
855
857
858 return result;
859}
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:68
END_CATALOG_STRUCT typedef FormData_pg_amop * Form_pg_amop
Definition pg_amop.h:92
static Datum ObjectIdGetDatum(Oid X)
Definition postgres.h:262
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 771 of file lsyscache.c.

772{
773 bool result;
775 int i;
776
777 /* Easy if they're the same operator */
778 if (opno1 == opno2)
779 return true;
780
781 /*
782 * We search through all the pg_amop entries for opno1.
783 */
785
786 result = false;
787 for (i = 0; i < catlist->n_members; i++)
788 {
789 HeapTuple op_tuple = &catlist->members[i]->tuple;
791
792 /*
793 * op_in_opfamily() is cheaper than GetIndexAmRoutineByAmId(), so
794 * check it first
795 */
796 if (op_in_opfamily(opno2, op_form->amopfamily) &&
798 {
799 result = true;
800 break;
801 }
802 }
803
805
806 return result;
807}
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 3496 of file lsyscache.c.

3497{
3498 /* The values[] array was separately palloc'd by deconstruct_array */
3499 if (sslot->values)
3500 pfree(sslot->values);
3501 /* The numbers[] array points into numbers_arr, do not pfree it */
3502 /* Free the detoasted array objects, if any */
3503 if (sslot->values_arr)
3504 pfree(sslot->values_arr);
3505 if (sslot->numbers_arr)
3506 pfree(sslot->numbers_arr);
3507}
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 1949 of file lsyscache.c.

1950{
1951 HeapTuple tp;
1952 char result;
1953
1955 if (!HeapTupleIsValid(tp))
1956 elog(ERROR, "cache lookup failed for function %u", funcid);
1957
1958 result = ((Form_pg_proc) GETSTRUCT(tp))->proparallel;
1959 ReleaseSysCache(tp);
1960 return result;
1961}
#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 3310 of file lsyscache.c.

3311{
3312 HeapTuple tp;
3313 int32 stawidth;
3314
3316 {
3317 stawidth = (*get_attavgwidth_hook) (relid, attnum);
3318 if (stawidth > 0)
3319 return stawidth;
3320 }
3322 ObjectIdGetDatum(relid),
3324 BoolGetDatum(false));
3325 if (HeapTupleIsValid(tp))
3326 {
3327 stawidth = ((Form_pg_statistic) GETSTRUCT(tp))->stawidth;
3328 ReleaseSysCache(tp);
3329 if (stawidth > 0)
3330 return stawidth;
3331 }
3332 return 0;
3333}
int32_t int32
Definition c.h:575
get_attavgwidth_hook_type get_attavgwidth_hook
Definition lsyscache.c:55
int16 attnum
FormData_pg_statistic * Form_pg_statistic
static Datum Int16GetDatum(int16 X)
Definition postgres.h:182
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 964 of file lsyscache.c.

965{
966 HeapTuple tp;
968 char result;
969
971 ObjectIdGetDatum(relid),
973 if (!HeapTupleIsValid(tp))
974 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
975 attnum, relid);
977 result = att_tup->attgenerated;
978 ReleaseSysCache(tp);
979 return result;
980}
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 903 of file lsyscache.c.

904{
905 HeapTuple tp;
906
909 if (HeapTupleIsValid(tp))
910 {
912 char *result;
913
914 result = pstrdup(NameStr(att_tup->attname));
915 ReleaseSysCache(tp);
916 return result;
917 }
918
919 if (!missing_ok)
920 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
921 attnum, relid);
922 return NULL;
923}
#define NameStr(name)
Definition c.h:798
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(), MergeConstraintsIntoExisting(), pg_get_constraintdef_worker(), pg_get_indexdef_worker(), pg_get_partkeydef_worker(), pg_get_statisticsobj_worker(), pg_get_triggerdef_worker(), processIndirection(), pub_contains_invalid_column(), QueueNNConstraintValidation(), RelationGetNotNullConstraints(), RememberAllDependentForRebuilding(), transformPartitionBound(), and transformPartitionRangeBounds().

◆ get_attnum()

◆ get_attoptions()

Datum get_attoptions ( Oid  relid,
int16  attnum 
)
extern

Definition at line 1046 of file lsyscache.c.

1047{
1048 HeapTuple tuple;
1049 Datum attopts;
1050 Datum result;
1051 bool isnull;
1052
1053 tuple = SearchSysCache2(ATTNUM,
1054 ObjectIdGetDatum(relid),
1056
1057 if (!HeapTupleIsValid(tuple))
1058 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
1059 attnum, relid);
1060
1062 &isnull);
1063
1064 if (isnull)
1065 result = (Datum) 0;
1066 else
1067 result = datumCopy(attopts, false, -1); /* text[] */
1068
1069 ReleaseSysCache(tuple);
1070
1071 return result;
1072}
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 3386 of file lsyscache.c.

3388{
3390 int i;
3391 Datum val;
3394 int narrayelem;
3397
3398 /* initialize *sslot properly */
3399 memset(sslot, 0, sizeof(AttStatsSlot));
3400
3401 for (i = 0; i < STATISTIC_NUM_SLOTS; i++)
3402 {
3403 if ((&stats->stakind1)[i] == reqkind &&
3404 (reqop == InvalidOid || (&stats->staop1)[i] == reqop))
3405 break;
3406 }
3407 if (i >= STATISTIC_NUM_SLOTS)
3408 return false; /* not there */
3409
3410 sslot->staop = (&stats->staop1)[i];
3411 sslot->stacoll = (&stats->stacoll1)[i];
3412
3413 if (flags & ATTSTATSSLOT_VALUES)
3414 {
3417
3418 /*
3419 * Detoast the array if needed, and in any case make a copy that's
3420 * under control of this AttStatsSlot.
3421 */
3423
3424 /*
3425 * Extract the actual array element type, and pass it back in case the
3426 * caller needs it.
3427 */
3428 sslot->valuetype = arrayelemtype = ARR_ELEMTYPE(statarray);
3429
3430 /* Need info about element type */
3433 elog(ERROR, "cache lookup failed for type %u", arrayelemtype);
3435
3436 /* Deconstruct array into Datum elements; NULLs not expected */
3439 typeForm->typlen,
3440 typeForm->typbyval,
3441 typeForm->typalign,
3442 &sslot->values, NULL, &sslot->nvalues);
3443
3444 /*
3445 * If the element type is pass-by-reference, we now have a bunch of
3446 * Datums that are pointers into the statarray, so we need to keep
3447 * that until free_attstatsslot. Otherwise, all the useful info is in
3448 * sslot->values[], so we can free the array object immediately.
3449 */
3450 if (!typeForm->typbyval)
3451 sslot->values_arr = statarray;
3452 else
3454
3456 }
3457
3458 if (flags & ATTSTATSSLOT_NUMBERS)
3459 {
3462
3463 /*
3464 * Detoast the array if needed, and in any case make a copy that's
3465 * under control of this AttStatsSlot.
3466 */
3468
3469 /*
3470 * We expect the array to be a 1-D float4 array; verify that. We don't
3471 * need to use deconstruct_array() since the array data is just going
3472 * to look like a C array of float4 values.
3473 */
3475 if (ARR_NDIM(statarray) != 1 || narrayelem <= 0 ||
3478 elog(ERROR, "stanumbers is not a 1-D float4 array");
3479
3480 /* Give caller a pointer directly into the statarray */
3481 sslot->numbers = (float4 *) ARR_DATA_PTR(statarray);
3482 sslot->nnumbers = narrayelem;
3483
3484 /* We'll free the statarray in free_attstatsslot */
3485 sslot->numbers_arr = statarray;
3486 }
3487
3488 return true;
3489}
#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:676
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 989 of file lsyscache.c.

990{
991 HeapTuple tp;
992
994 ObjectIdGetDatum(relid),
996 if (HeapTupleIsValid(tp))
997 {
999 Oid result;
1000
1001 result = att_tup->atttypid;
1002 ReleaseSysCache(tp);
1003 return result;
1004 }
1005 else
1006 return InvalidOid;
1007}

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

1021{
1022 HeapTuple tp;
1024
1026 ObjectIdGetDatum(relid),
1028 if (!HeapTupleIsValid(tp))
1029 elog(ERROR, "cache lookup failed for attribute %d of relation %u",
1030 attnum, relid);
1032
1033 *typid = att_tup->atttypid;
1034 *typmod = att_tup->atttypmod;
1035 *collid = att_tup->attcollation;
1036 ReleaseSysCache(tp);
1037}
Oid collid

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

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

◆ get_base_element_type()

Oid get_base_element_type ( Oid  typid)
extern

Definition at line 2984 of file lsyscache.c.

2985{
2986 /*
2987 * We loop to find the bottom base type in a stack of domains.
2988 */
2989 for (;;)
2990 {
2991 HeapTuple tup;
2993
2995 if (!HeapTupleIsValid(tup))
2996 break;
2998 if (typTup->typtype != TYPTYPE_DOMAIN)
2999 {
3000 /* Not a domain, so stop descending */
3001 Oid result;
3002
3003 /* This test must match get_element_type */
3005 result = typTup->typelem;
3006 else
3007 result = InvalidOid;
3009 return result;
3010 }
3011
3012 typid = typTup->typbasetype;
3014 }
3015
3016 /* Like get_element_type, silently return InvalidOid for bogus input */
3017 return InvalidOid;
3018}

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

1084{
1085 Oid oid;
1086
1090 if (!OidIsValid(oid) && !missing_ok)
1091 ereport(ERROR,
1093 errmsg("cast from type %s to type %s does not exist",
1096 return oid;
1097}
#define OidIsValid(objectId)
Definition c.h:821
int errcode(int sqlerrcode)
Definition elog.c:874
int errmsg(const char *fmt,...)
Definition elog.c:1093
#define ereport(elevel,...)
Definition elog.h:150
char * format_type_be(Oid type_oid)
#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 1130 of file lsyscache.c.

1131{
1132 HeapTuple tp;
1134 bool result;
1135
1137 if (!HeapTupleIsValid(tp))
1138 elog(ERROR, "cache lookup failed for collation %u", colloid);
1140 result = colltup->collisdeterministic;
1141 ReleaseSysCache(tp);
1142 return result;
1143}
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 475 of file lsyscache.c.

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

1190{
1191 HeapTuple tp;
1192
1194 if (HeapTupleIsValid(tp))
1195 {
1197 Oid result;
1198
1199 if (contup->contype == CONSTRAINT_UNIQUE ||
1200 contup->contype == CONSTRAINT_PRIMARY ||
1201 contup->contype == CONSTRAINT_EXCLUSION)
1202 result = contup->conindid;
1203 else
1204 result = InvalidOid;
1205 ReleaseSysCache(tp);
1206 return result;
1207 }
1208 else
1209 return InvalidOid;
1210}
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 1157 of file lsyscache.c.

1158{
1159 HeapTuple tp;
1160
1162 if (HeapTupleIsValid(tp))
1163 {
1165 char *result;
1166
1167 result = pstrdup(NameStr(contup->conname));
1168 ReleaseSysCache(tp);
1169 return result;
1170 }
1171 else
1172 return NULL;
1173}

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

1220{
1221 HeapTuple tp;
1222 char contype;
1223
1225 if (!HeapTupleIsValid(tp))
1226 elog(ERROR, "cache lookup failed for constraint %u", conoid);
1227
1228 contype = ((Form_pg_constraint) GETSTRUCT(tp))->contype;
1229 ReleaseSysCache(tp);
1230
1231 return contype;
1232}

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

1243{
1245 char *result;
1246
1249 {
1252 }
1253 else
1254 result = NULL;
1255
1256 return result;
1257}
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 324 of file lsyscache.c.

325{
326 Oid result = InvalidOid;
327 Oid opfamily;
328 Oid opcintype;
329 CompareType cmptype;
330
331 /* Find the operator in pg_amop */
333 &opfamily, &opcintype, &cmptype))
334 {
335 /* Found a suitable opfamily, get matching equality operator */
336 result = get_opfamily_member_for_cmptype(opfamily,
337 opcintype,
338 opcintype,
339 COMPARE_EQ);
340 if (reverse)
341 *reverse = (cmptype == COMPARE_GT);
342 }
343
344 return result;
345}
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:259
Oid get_opfamily_member_for_cmptype(Oid opfamily, Oid lefttype, Oid righttype, CompareType cmptype)
Definition lsyscache.c:197

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

1988{
1989 HeapTuple tp;
1990 bool result;
1991
1993 if (!HeapTupleIsValid(tp))
1994 elog(ERROR, "cache lookup failed for function %u", funcid);
1995
1996 result = ((Form_pg_proc) GETSTRUCT(tp))->proleakproof;
1997 ReleaseSysCache(tp);
1998 return result;
1999}

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

1783{
1784 HeapTuple tp;
1785
1787 if (HeapTupleIsValid(tp))
1788 {
1790 Oid result;
1791
1792 result = functup->pronamespace;
1793 ReleaseSysCache(tp);
1794 return result;
1795 }
1796 else
1797 return InvalidOid;
1798}

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

1825{
1826 HeapTuple tp;
1827 int result;
1828
1830 if (!HeapTupleIsValid(tp))
1831 elog(ERROR, "cache lookup failed for function %u", funcid);
1832
1833 result = ((Form_pg_proc) GETSTRUCT(tp))->pronargs;
1834 ReleaseSysCache(tp);
1835 return result;
1836}
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 1968 of file lsyscache.c.

1969{
1970 HeapTuple tp;
1971 char result;
1972
1974 if (!HeapTupleIsValid(tp))
1975 elog(ERROR, "cache lookup failed for function %u", funcid);
1976
1977 result = ((Form_pg_proc) GETSTRUCT(tp))->prokind;
1978 ReleaseSysCache(tp);
1979 return result;
1980}

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

1893{
1894 HeapTuple tp;
1895 bool result;
1896
1898 if (!HeapTupleIsValid(tp))
1899 elog(ERROR, "cache lookup failed for function %u", funcid);
1900
1901 result = ((Form_pg_proc) GETSTRUCT(tp))->proretset;
1902 ReleaseSysCache(tp);
1903 return result;
1904}

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

Referenced by 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 1846 of file lsyscache.c.

1847{
1848 HeapTuple tp;
1850 Oid result;
1851
1853 if (!HeapTupleIsValid(tp))
1854 elog(ERROR, "cache lookup failed for function %u", funcid);
1855
1857
1858 result = procstruct->prorettype;
1859 *nargs = (int) procstruct->pronargs;
1860 Assert(*nargs == procstruct->proargtypes.dim1);
1861 *argtypes = (Oid *) palloc(*nargs * sizeof(Oid));
1862 memcpy(*argtypes, procstruct->proargtypes.values, *nargs * sizeof(Oid));
1863
1864 ReleaseSysCache(tp);
1865 return result;
1866}
#define Assert(condition)
Definition c.h:906
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 2008 of file lsyscache.c.

2009{
2010 HeapTuple tp;
2011
2013 if (HeapTupleIsValid(tp))
2014 {
2016 RegProcedure result;
2017
2018 result = functup->prosupport;
2019 ReleaseSysCache(tp);
2020 return result;
2021 }
2022 else
2023 return (RegProcedure) InvalidOid;
2024}
regproc RegProcedure
Definition c.h:697

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

1874{
1875 HeapTuple tp;
1876 Oid result;
1877
1879 if (!HeapTupleIsValid(tp))
1880 elog(ERROR, "cache lookup failed for function %u", funcid);
1881
1882 result = ((Form_pg_proc) GETSTRUCT(tp))->provariadic;
1883 ReleaseSysCache(tp);
1884 return result;
1885}

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

3665{
3666 HeapTuple tuple;
3667 Form_pg_index rd_index;
3668 Datum datum;
3670 Oid opclass;
3671
3672 /* First we need to know the column's opclass. */
3673
3675 if (!HeapTupleIsValid(tuple))
3676 return InvalidOid;
3677
3678 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3679
3680 /* caller is supposed to guarantee this */
3681 Assert(attno > 0 && attno <= rd_index->indnatts);
3682
3683 /* Non-key attributes don't have an opclass */
3684 if (attno > rd_index->indnkeyatts)
3685 {
3686 ReleaseSysCache(tuple);
3687 return InvalidOid;
3688 }
3689
3691 indclass = ((oidvector *) DatumGetPointer(datum));
3692
3694 opclass = indclass->values[attno - 1];
3695
3696 ReleaseSysCache(tuple);
3697
3698 return opclass;
3699}
END_CATALOG_STRUCT typedef FormData_pg_index * Form_pg_index
Definition pg_index.h:74
static Pointer DatumGetPointer(Datum X)
Definition postgres.h:342
Definition c.h:778

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

3754{
3755 bool isclustered;
3756 HeapTuple tuple;
3757 Form_pg_index rd_index;
3758
3760 if (!HeapTupleIsValid(tuple))
3761 elog(ERROR, "cache lookup failed for index %u", index_oid);
3762
3763 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3764 isclustered = rd_index->indisclustered;
3765 ReleaseSysCache(tuple);
3766
3767 return isclustered;
3768}

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

Referenced by cluster(), cluster_rel(), mark_index_clustered(), and RememberClusterOnForRebuilding().

◆ get_index_isreplident()

bool get_index_isreplident ( Oid  index_oid)
extern

Definition at line 3707 of file lsyscache.c.

3708{
3709 HeapTuple tuple;
3710 Form_pg_index rd_index;
3711 bool result;
3712
3714 if (!HeapTupleIsValid(tuple))
3715 return false;
3716
3717 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3718 result = rd_index->indisreplident;
3719 ReleaseSysCache(tuple);
3720
3721 return result;
3722}

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

3731{
3732 bool isvalid;
3733 HeapTuple tuple;
3734 Form_pg_index rd_index;
3735
3737 if (!HeapTupleIsValid(tuple))
3738 elog(ERROR, "cache lookup failed for index %u", index_oid);
3739
3740 rd_index = (Form_pg_index) GETSTRUCT(tuple);
3741 isvalid = rd_index->indisvalid;
3742 ReleaseSysCache(tuple);
3743
3744 return isvalid;
3745}

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

1264{
1265 HeapTuple tp;
1266
1268 if (HeapTupleIsValid(tp))
1269 {
1271 char *result;
1272
1273 result = pstrdup(NameStr(lantup->lanname));
1274 ReleaseSysCache(tp);
1275 return result;
1276 }
1277
1278 if (!missing_ok)
1279 elog(ERROR, "cache lookup failed for language %u",
1280 langoid);
1281 return NULL;
1282}
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 428 of file lsyscache.c.

429{
430 List *result = NIL;
432 int i;
433
434 /*
435 * Search pg_amop to see if the target operator is registered as the "="
436 * operator of any opfamily of an ordering index type.
437 */
439
440 for (i = 0; i < catlist->n_members; i++)
441 {
442 HeapTuple tuple = &catlist->members[i]->tuple;
444
445 /* must be ordering index equality */
446 if (get_opmethod_canorder(aform->amopmethod) &&
447 IndexAmTranslateStrategy(aform->amopstrategy,
448 aform->amopmethod,
449 aform->amopfamily,
450 true) == COMPARE_EQ)
451 result = lappend_oid(result, aform->amopfamily);
452 }
453
455
456 return result;
457}
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:221
#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

Definition at line 3635 of file lsyscache.c.

3636{
3637 HeapTuple tp;
3638
3640 if (HeapTupleIsValid(tp))
3641 {
3643 Oid result;
3644
3645 result = rngtup->rngtypid;
3646 ReleaseSysCache(tp);
3647 return result;
3648 }
3649 else
3650 return InvalidOid;
3651}
END_CATALOG_STRUCT typedef FormData_pg_range * Form_pg_range
Definition pg_range.h:71

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

Referenced by AlterTypeOwner(), check_generic_type_consistency(), enforce_generic_type_consistency(), load_multirangetype_info(), pg_type_aclmask_ext(), resolve_anyelement_from_others(), resolve_anyrange_from_others(), and statatt_get_type().

◆ get_namespace_name()

char * get_namespace_name ( Oid  nspid)
extern

Definition at line 3518 of file lsyscache.c.

3519{
3520 HeapTuple tp;
3521
3523 if (HeapTupleIsValid(tp))
3524 {
3526 char *result;
3527
3528 result = pstrdup(NameStr(nsptup->nspname));
3529 ReleaseSysCache(tp);
3530 return result;
3531 }
3532 else
3533 return NULL;
3534}
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_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 575 of file lsyscache.c.

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

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

667{
668 List *result = NIL;
671 int i;
672
673 /*
674 * Find all the pg_amop entries containing the operator.
675 */
677
678 for (i = 0; i < catlist->n_members; i++)
679 {
680 HeapTuple op_tuple = &catlist->members[i]->tuple;
682 CompareType cmptype;
683
684 /* must be ordering index */
685 if (!get_opmethod_canorder(op_form->amopmethod))
686 continue;
687
688 /* Get the operator's comparison type */
689 cmptype = IndexAmTranslateStrategy(op_form->amopstrategy,
690 op_form->amopmethod,
691 op_form->amopfamily,
692 true);
693
694 /* should not happen */
695 if (cmptype == COMPARE_INVALID)
696 continue;
697
699 thisresult->opfamily_id = op_form->amopfamily;
700 thisresult->cmptype = cmptype;
701 thisresult->oplefttype = op_form->amoplefttype;
702 thisresult->oprighttype = op_form->amoprighttype;
703 result = lappend(result, thisresult);
704 }
705
707
708 /*
709 * If we didn't find any btree opfamily containing the operator, perhaps
710 * it is a <> operator. See if it has a negator that is in an opfamily.
711 */
712 if (result == NIL)
713 {
714 Oid op_negator = get_negator(opno);
715
717 {
720
721 for (i = 0; i < catlist->n_members; i++)
722 {
723 HeapTuple op_tuple = &catlist->members[i]->tuple;
725 const IndexAmRoutine *amroutine = GetIndexAmRoutineByAmId(op_form->amopmethod, false);
726 CompareType cmptype;
727
728 /* must be ordering index */
729 if (!amroutine->amcanorder)
730 continue;
731
732 /* Get the operator's comparison type */
733 cmptype = IndexAmTranslateStrategy(op_form->amopstrategy,
734 op_form->amopmethod,
735 op_form->amopfamily,
736 true);
737
738 /* Only consider negators that are = */
739 if (cmptype != COMPARE_EQ)
740 continue;
741
742 /* OK, report it as COMPARE_NE */
744 thisresult->opfamily_id = op_form->amopfamily;
745 thisresult->cmptype = COMPARE_NE;
746 thisresult->oplefttype = op_form->amoplefttype;
747 thisresult->oprighttype = op_form->amoprighttype;
748 result = lappend(result, thisresult);
749 }
750
752 }
753 }
754
755 return result;
756}
@ 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:1683

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

142{
143 HeapTuple tp;
145
147 ObjectIdGetDatum(opno),
149 ObjectIdGetDatum(opfamily));
150 if (!HeapTupleIsValid(tp))
151 elog(ERROR, "operator %u is not a member of opfamily %u",
152 opno, opfamily);
154 *strategy = amop_tup->amopstrategy;
155 *lefttype = amop_tup->amoplefttype;
156 *righttype = amop_tup->amoprighttype;
157 ReleaseSysCache(tp);
158}
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 110 of file lsyscache.c.

111{
112 HeapTuple tp;
114 Oid result;
115
117 ObjectIdGetDatum(opno),
119 ObjectIdGetDatum(opfamily));
120 if (!HeapTupleIsValid(tp))
121 return InvalidOid;
123 result = amop_tup->amopsortfamily;
124 ReleaseSysCache(tp);
125 return result;
126}

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

1484{
1485 HeapTuple tp;
1486
1488 if (HeapTupleIsValid(tp))
1489 {
1491 Oid result;
1492
1493 result = optup->oprresult;
1494 ReleaseSysCache(tp);
1495 return result;
1496 }
1497 else
1498 return InvalidOid;
1499}

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

1293{
1294 HeapTuple tp;
1296 Oid result;
1297
1298 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1299 if (!HeapTupleIsValid(tp))
1300 elog(ERROR, "cache lookup failed for opclass %u", opclass);
1302
1303 result = cla_tup->opcfamily;
1304 ReleaseSysCache(tp);
1305 return result;
1306}
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(), and lookup_type_cache().

◆ get_opclass_input_type()

Oid get_opclass_input_type ( Oid  opclass)
extern

Definition at line 1314 of file lsyscache.c.

1315{
1316 HeapTuple tp;
1318 Oid result;
1319
1320 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1321 if (!HeapTupleIsValid(tp))
1322 elog(ERROR, "cache lookup failed for opclass %u", opclass);
1324
1325 result = cla_tup->opcintype;
1326 ReleaseSysCache(tp);
1327 return result;
1328}

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 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->opcmethod;
1374 ReleaseSysCache(tp);
1375 return result;
1376}

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

1338{
1339 HeapTuple tp;
1341
1342 tp = SearchSysCache1(CLAOID, ObjectIdGetDatum(opclass));
1343 if (!HeapTupleIsValid(tp))
1344 return false;
1345
1347
1348 *opfamily = cla_tup->opcfamily;
1349 *opcintype = cla_tup->opcintype;
1350
1351 ReleaseSysCache(tp);
1352
1353 return true;
1354}

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

1436{
1437 HeapTuple tp;
1438
1440 if (HeapTupleIsValid(tp))
1441 {
1443 RegProcedure result;
1444
1445 result = optup->oprcode;
1446 ReleaseSysCache(tp);
1447 return result;
1448 }
1449 else
1450 return (RegProcedure) InvalidOid;
1451}

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

199{
201 StrategyNumber strategy;
202
203 opmethod = get_opfamily_method(opfamily);
204 strategy = IndexAmTranslateCompareType(cmptype, opmethod, opfamily, true);
205 if (!strategy)
206 return InvalidOid;
207 return get_opfamily_member(opfamily, lefttype, righttype, strategy);
208}
StrategyNumber IndexAmTranslateCompareType(CompareType cmptype, Oid amoid, Oid opfamily, bool missing_ok)
Definition amapi.c:161
Oid get_opfamily_method(Oid opfid)
Definition lsyscache.c:1386
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 1386 of file lsyscache.c.

1387{
1388 HeapTuple tp;
1390 Oid result;
1391
1393 if (!HeapTupleIsValid(tp))
1394 elog(ERROR, "cache lookup failed for operator family %u", opfid);
1396
1397 result = opfform->opfmethod;
1398 ReleaseSysCache(tp);
1399 return result;
1400}
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 1403 of file lsyscache.c.

1404{
1405 HeapTuple tup;
1406 char *opfname;
1408
1410
1411 if (!HeapTupleIsValid(tup))
1412 {
1413 if (!missing_ok)
1414 elog(ERROR, "cache lookup failed for operator family %u", opfid);
1415 return NULL;
1416 }
1417
1419 opfname = pstrdup(NameStr(opfform->opfname));
1420
1422
1423 return opfname;
1424}

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

1461{
1462 HeapTuple tp;
1463
1465 if (HeapTupleIsValid(tp))
1466 {
1468 char *result;
1469
1470 result = pstrdup(NameStr(optup->oprname));
1471 ReleaseSysCache(tp);
1472 return result;
1473 }
1474 else
1475 return NULL;
1476}

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

1732{
1733 HeapTuple tp;
1734
1736 if (HeapTupleIsValid(tp))
1737 {
1739 RegProcedure result;
1740
1741 result = optup->oprjoin;
1742 ReleaseSysCache(tp);
1743 return result;
1744 }
1745 else
1746 return (RegProcedure) InvalidOid;
1747}

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

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

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

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

2964{
2965 Oid array_type = get_array_type(typid);
2966
2967 if (OidIsValid(array_type))
2968 return array_type;
2969 if (OidIsValid(get_element_type(typid)))
2970 return typid;
2971 return InvalidOid;
2972}
Oid get_element_type(Oid typid)
Definition lsyscache.c:2911
Oid get_array_type(Oid typid)
Definition lsyscache.c:2939

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

Referenced by build_subplan(), and exprType().

◆ get_publication_name()

char * get_publication_name ( Oid  pubid,
bool  missing_ok 
)
extern

Definition at line 3797 of file lsyscache.c.

3798{
3799 HeapTuple tup;
3800 char *pubname;
3802
3804
3805 if (!HeapTupleIsValid(tup))
3806 {
3807 if (!missing_ok)
3808 elog(ERROR, "cache lookup failed for publication %u", pubid);
3809 return NULL;
3810 }
3811
3813 pubname = pstrdup(NameStr(pubform->pubname));
3814
3816
3817 return pubname;
3818}
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 getObjectDescription(), getObjectIdentityParts(), and getPublicationSchemaInfo().

◆ get_publication_oid()

Oid get_publication_oid ( const char pubname,
bool  missing_ok 
)
extern

Definition at line 3777 of file lsyscache.c.

3778{
3779 Oid oid;
3780
3782 CStringGetDatum(pubname));
3783 if (!OidIsValid(oid) && !missing_ok)
3784 ereport(ERROR,
3786 errmsg("publication \"%s\" does not exist", pubname)));
3787 return oid;
3788}
static Datum CStringGetDatum(const char *X)
Definition postgres.h:380
#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 3585 of file lsyscache.c.

3586{
3587 HeapTuple tp;
3588
3590 if (HeapTupleIsValid(tp))
3591 {
3593 Oid result;
3594
3595 result = rngtup->rngcollation;
3596 ReleaseSysCache(tp);
3597 return result;
3598 }
3599 else
3600 return InvalidOid;
3601}

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

3611{
3612 HeapTuple tp;
3613
3615 if (HeapTupleIsValid(tp))
3616 {
3618 Oid result;
3619
3620 result = rngtup->rngmultitypid;
3621 ReleaseSysCache(tp);
3622 return result;
3623 }
3624 else
3625 return InvalidOid;
3626}

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

3560{
3561 HeapTuple tp;
3562
3564 if (HeapTupleIsValid(tp))
3565 {
3567 Oid result;
3568
3569 result = rngtup->rngsubtype;
3570 ReleaseSysCache(tp);
3571 return result;
3572 }
3573 else
3574 return InvalidOid;
3575}

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

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

◆ get_rel_name()

char * get_rel_name ( Oid  relid)
extern

Definition at line 2078 of file lsyscache.c.

2079{
2080 HeapTuple tp;
2081
2083 if (HeapTupleIsValid(tp))
2084 {
2086 char *result;
2087
2088 result = pstrdup(NameStr(reltup->relname));
2089 ReleaseSysCache(tp);
2090 return result;
2091 }
2092 else
2093 return NULL;
2094}
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(), AlterPublicationOptions(), AlterSubscription_refresh(), AlterSubscription_refresh_seq(), AlterTableNamespace(), ATExecAlterConstraint(), ATExecChangeOwner(), ATPrepAddPrimaryKey(), BeginCopyTo(), 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(), cluster_is_permitted_for_relation(), 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_relation_constraint_attnos(), get_relation_constraint_oid(), get_relation_name(), get_relation_policy_oid(), get_rewrite_oid(), get_trigger_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(), 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(), postgresExplainForeignScan(), process_owned_by(), QueueNNConstraintValidation(), refuseDupeIndexAttach(), reindex_index(), reindex_relation(), ReindexMultipleInternal(), ReindexPartitions(), ReindexRelationConcurrently(), RememberClusterOnForRebuilding(), RememberReplicaIdentityForRebuilding(), RemoveSubscriptionRel(), RenameConstraintById(), renametrig(), satisfies_hash_partition(), set_rtable_names(), show_modifytable_info(), subquery_planner(), swap_relation_files(), SysCacheGetAttrNotNull(), table_to_xml_internal(), TargetPrivilegesCheck(), transformAlterTableStmt(), transformPartitionCmdForSplit(), and verifyNotNullPKCompatible().

◆ get_rel_namespace()

◆ get_rel_persistence()

char get_rel_persistence ( Oid  relid)
extern

Definition at line 2228 of file lsyscache.c.

2229{
2230 HeapTuple tp;
2232 char result;
2233
2235 if (!HeapTupleIsValid(tp))
2236 elog(ERROR, "cache lookup failed for relation %u", relid);
2238 result = reltup->relpersistence;
2239 ReleaseSysCache(tp);
2240
2241 return result;
2242}

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

Referenced by 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 2250 of file lsyscache.c.

2251{
2252 HeapTuple tp;
2254 Oid result;
2255
2257 if (!HeapTupleIsValid(tp))
2258 elog(ERROR, "cache lookup failed for relation %u", relid);
2260 result = reltup->relam;
2261 ReleaseSysCache(tp);
2262
2263 return result;
2264}

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

2178{
2179 HeapTuple tp;
2180
2182 if (HeapTupleIsValid(tp))
2183 {
2185 bool result;
2186
2187 result = reltup->relispartition;
2188 ReleaseSysCache(tp);
2189 return result;
2190 }
2191 else
2192 return false;
2193}

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

2154{
2155 HeapTuple tp;
2156
2158 if (HeapTupleIsValid(tp))
2159 {
2161 char result;
2162
2163 result = reltup->relkind;
2164 ReleaseSysCache(tp);
2165 return result;
2166 }
2167 else
2168 return '\0';
2169}

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

Referenced by AlterPublicationOptions(), AlterSubscription_refresh(), AlterTableMoveAll(), AlterTypeNamespaceInternal(), AlterTypeOwner(), ATExecAlterConstrDeferrability(), ATExecAlterConstrEnforceability(), 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_cluster_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 2204 of file lsyscache.c.

2205{
2206 HeapTuple tp;
2207
2209 if (HeapTupleIsValid(tp))
2210 {
2212 Oid result;
2213
2214 result = reltup->reltablespace;
2215 ReleaseSysCache(tp);
2216 return result;
2217 }
2218 else
2219 return InvalidOid;
2220}

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

2130{
2131 HeapTuple tp;
2132
2134 if (HeapTupleIsValid(tp))
2135 {
2137 Oid result;
2138
2139 result = reltup->reltype;
2140 ReleaseSysCache(tp);
2141 return result;
2142 }
2143 else
2144 return InvalidOid;
2145}

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

Referenced by ExecAlterExtensionContentsRecurse(), get_tupdesc_for_join_scan_tuples(), 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 3847 of file lsyscache.c.

3848{
3849 HeapTuple tup;
3850 char *subname;
3852
3854
3855 if (!HeapTupleIsValid(tup))
3856 {
3857 if (!missing_ok)
3858 elog(ERROR, "cache lookup failed for subscription %u", subid);
3859 return NULL;
3860 }
3861
3863 subname = pstrdup(NameStr(subform->subname));
3864
3866
3867 return subname;
3868}
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 3827 of file lsyscache.c.

3828{
3829 Oid oid;
3830
3833 if (!OidIsValid(oid) && !missing_ok)
3834 ereport(ERROR,
3836 errmsg("subscription \"%s\" does not exist", subname)));
3837 return oid;
3838}
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 2270 of file lsyscache.c.

2271{
2272 HeapTuple tup;
2273
2274 if (!list_member_oid(trftypes, typid))
2275 return InvalidOid;
2276
2278 ObjectIdGetDatum(langid));
2279 if (HeapTupleIsValid(tup))
2280 {
2281 Oid funcid;
2282
2283 funcid = ((Form_pg_transform) GETSTRUCT(tup))->trffromsql;
2285 return funcid;
2286 }
2287 else
2288 return InvalidOid;
2289}
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 2292 of file lsyscache.c.

2293{
2294 HeapTuple tup;
2295
2296 if (!list_member_oid(trftypes, typid))
2297 return InvalidOid;
2298
2300 ObjectIdGetDatum(langid));
2301 if (HeapTupleIsValid(tup))
2302 {
2303 Oid funcid;
2304
2305 funcid = ((Form_pg_transform) GETSTRUCT(tup))->trftosql;
2307 return funcid;
2308 }
2309 else
2310 return InvalidOid;
2311}

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

2884{
2885 HeapTuple tp;
2886
2888 if (HeapTupleIsValid(tp))
2889 {
2891 Oid result;
2892
2893 result = typtup->typrelid;
2894 ReleaseSysCache(tp);
2895 return result;
2896 }
2897 else
2898 return InvalidOid;
2899}

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

2731{
2732 int typlen = get_typlen(typid);
2734
2735 /*
2736 * Easy if it's a fixed-width type
2737 */
2738 if (typlen > 0)
2739 return typlen;
2740
2741 /*
2742 * type_maximum_size knows the encoding of typmod for some datatypes;
2743 * don't duplicate that knowledge here.
2744 */
2745 maxwidth = type_maximum_size(typid, typmod);
2746 if (maxwidth > 0)
2747 {
2748 /*
2749 * For BPCHAR, the max width is also the only width. Otherwise we
2750 * need to guess about the typical data width given the max. A sliding
2751 * scale for percentage of max width seems reasonable.
2752 */
2753 if (typid == BPCHAROID)
2754 return maxwidth;
2755 if (maxwidth <= 32)
2756 return maxwidth; /* assume full width */
2757 if (maxwidth < 1000)
2758 return 32 + (maxwidth - 32) / 2; /* assume 50% */
2759
2760 /*
2761 * Beyond 1000, assume we're looking at something like
2762 * "varchar(10000)" where the limit isn't actually reached often, and
2763 * use a fixed estimate.
2764 */
2765 return 32 + (1000 - 32) / 2;
2766 }
2767
2768 /*
2769 * Oops, we have no idea ... wild guess time.
2770 */
2771 return 32;
2772}
int32 type_maximum_size(Oid type_oid, int32 typemod)
int16 get_typlen(Oid typid)
Definition lsyscache.c:2347

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

2373{
2374 HeapTuple tp;
2375
2377 if (HeapTupleIsValid(tp))
2378 {
2380 bool result;
2381
2382 result = typtup->typbyval;
2383 ReleaseSysCache(tp);
2384 return result;
2385 }
2386 else
2387 return false;
2388}

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

2601{
2604 Datum datum;
2605 bool isNull;
2606 Node *expr;
2607
2610 elog(ERROR, "cache lookup failed for type %u", typid);
2612
2613 /*
2614 * typdefault and typdefaultbin are potentially null, so don't try to
2615 * access 'em as struct fields. Must do it the hard way with
2616 * SysCacheGetAttr.
2617 */
2618 datum = SysCacheGetAttr(TYPEOID,
2619 typeTuple,
2621 &isNull);
2622
2623 if (!isNull)
2624 {
2625 /* We have an expression default */
2626 expr = stringToNode(TextDatumGetCString(datum));
2627 }
2628 else
2629 {
2630 /* Perhaps we have a plain literal default */
2631 datum = SysCacheGetAttr(TYPEOID,
2632 typeTuple,
2634 &isNull);
2635
2636 if (!isNull)
2637 {
2638 char *strDefaultVal;
2639
2640 /* Convert text datum to C string */
2642 /* Convert C string to a value of the given type */
2643 datum = OidInputFunctionCall(type->typinput, strDefaultVal,
2645 /* Build a Const node containing the value */
2646 expr = (Node *) makeConst(typid,
2647 -1,
2648 type->typcollation,
2649 type->typlen,
2650 datum,
2651 false,
2652 type->typbyval);
2654 }
2655 else
2656 {
2657 /* No default */
2658 expr = NULL;
2659 }
2660 }
2661
2663
2664 return expr;
2665}
#define TextDatumGetCString(d)
Definition builtins.h:99
Datum OidInputFunctionCall(Oid functionId, char *str, Oid typioparam, int32 typmod)
Definition fmgr.c:1754
Oid getTypeIOParam(HeapTuple typeTuple)
Definition lsyscache.c:2453
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 2475 of file lsyscache.c.

2483{
2486
2487 /*
2488 * In bootstrap mode, pass it off to bootstrap.c. This hack allows us to
2489 * use array_in and array_out during bootstrap.
2490 */
2492 {
2493 Oid typinput;
2494 Oid typoutput;
2495 Oid typcollation;
2496
2498 typlen,
2499 typbyval,
2500 typalign,
2501 typdelim,
2502 typioparam,
2503 &typinput,
2504 &typoutput,
2505 &typcollation);
2506 switch (which_func)
2507 {
2508 case IOFunc_input:
2509 *func = typinput;
2510 break;
2511 case IOFunc_output:
2512 *func = typoutput;
2513 break;
2514 default:
2515 elog(ERROR, "binary I/O not supported during bootstrap");
2516 break;
2517 }
2518 return;
2519 }
2520
2523 elog(ERROR, "cache lookup failed for type %u", typid);
2525
2526 *typlen = typeStruct->typlen;
2527 *typbyval = typeStruct->typbyval;
2528 *typalign = typeStruct->typalign;
2529 *typdelim = typeStruct->typdelim;
2530 *typioparam = getTypeIOParam(typeTuple);
2531 switch (which_func)
2532 {
2533 case IOFunc_input:
2534 *func = typeStruct->typinput;
2535 break;
2536 case IOFunc_output:
2537 *func = typeStruct->typoutput;
2538 break;
2539 case IOFunc_receive:
2540 *func = typeStruct->typreceive;
2541 break;
2542 case IOFunc_send:
2543 *func = typeStruct->typsend;
2544 break;
2545 }
2547}
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:963
#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 2323 of file lsyscache.c.

2324{
2325 HeapTuple tp;
2326
2328 if (HeapTupleIsValid(tp))
2329 {
2331 bool result;
2332
2333 result = typtup->typisdefined;
2334 ReleaseSysCache(tp);
2335 return result;
2336 }
2337 else
2338 return false;
2339}

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

3159{
3160 HeapTuple tp;
3161
3163 if (HeapTupleIsValid(tp))
3164 {
3166 Oid result;
3167
3168 result = typtup->typmodin;
3169 ReleaseSysCache(tp);
3170 return result;
3171 }
3172 else
3173 return InvalidOid;
3174}

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

◆ get_typstorage()

char get_typstorage ( Oid  typid)
extern

Definition at line 2571 of file lsyscache.c.

2572{
2573 HeapTuple tp;
2574
2576 if (HeapTupleIsValid(tp))
2577 {
2579 char result;
2580
2581 result = typtup->typstorage;
2582 ReleaseSysCache(tp);
2583 return result;
2584 }
2585 else
2586 return TYPSTORAGE_PLAIN;
2587}

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

3250{
3251 HeapTuple tp;
3252
3254 if (HeapTupleIsValid(tp))
3255 {
3257 RegProcedure handler = typform->typsubscript;
3258
3259 if (typelemp)
3260 *typelemp = typform->typelem;
3261 ReleaseSysCache(tp);
3262 return handler;
3263 }
3264 else
3265 {
3266 if (typelemp)
3268 return InvalidOid;
3269 }
3270}

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

2691{
2692 /*
2693 * We loop to find the bottom base type in a stack of domains.
2694 */
2695 for (;;)
2696 {
2697 HeapTuple tup;
2699
2701 if (!HeapTupleIsValid(tup))
2702 elog(ERROR, "cache lookup failed for type %u", typid);
2704 if (typTup->typtype != TYPTYPE_DOMAIN)
2705 {
2706 /* Not a domain, so done */
2708 break;
2709 }
2710
2711 Assert(*typmod == -1);
2712 typid = typTup->typbasetype;
2713 *typmod = typTup->typtypmod;
2714
2716 }
2717
2718 return typid;
2719}

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

3283{
3284 RegProcedure typsubscript = get_typsubscript(typid, typelemp);
3285
3286 if (!OidIsValid(typsubscript))
3287 return NULL;
3288
3289 return (const struct SubscriptRoutines *)
3290 DatumGetPointer(OidFunctionCall0(typsubscript));
3291}
#define OidFunctionCall0(functionId)
Definition fmgr.h:720
RegProcedure get_typsubscript(Oid typid, Oid *typelemp)
Definition lsyscache.c:3249

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

3093{
3096
3099 elog(ERROR, "cache lookup failed for type %u", type);
3101
3102 if (!pt->typisdefined)
3103 ereport(ERROR,
3105 errmsg("type %s is only a shell",
3106 format_type_be(type))));
3107 if (!OidIsValid(pt->typreceive))
3108 ereport(ERROR,
3110 errmsg("no binary input function available for type %s",
3111 format_type_be(type))));
3112
3113 *typReceive = pt->typreceive;
3115
3117}

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

3126{
3129
3132 elog(ERROR, "cache lookup failed for type %u", type);
3134
3135 if (!pt->typisdefined)
3136 ereport(ERROR,
3138 errmsg("type %s is only a shell",
3139 format_type_be(type))));
3140 if (!OidIsValid(pt->typsend))
3141 ereport(ERROR,
3143 errmsg("no binary output function available for type %s",
3144 format_type_be(type))));
3145
3146 *typSend = pt->typsend;
3147 *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
3148
3150}

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

3027{
3030
3033 elog(ERROR, "cache lookup failed for type %u", type);
3035
3036 if (!pt->typisdefined)
3037 ereport(ERROR,
3039 errmsg("type %s is only a shell",
3040 format_type_be(type))));
3041 if (!OidIsValid(pt->typinput))
3042 ereport(ERROR,
3044 errmsg("no input function available for type %s",
3045 format_type_be(type))));
3046
3047 *typInput = pt->typinput;
3049
3051}

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

2454{
2456
2457 /*
2458 * Array types get their typelem as parameter; everybody else gets their
2459 * own type OID as parameter.
2460 */
2461 if (OidIsValid(typeStruct->typelem))
2462 return typeStruct->typelem;
2463 else
2464 return typeStruct->oid;
2465}

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

3060{
3063
3066 elog(ERROR, "cache lookup failed for type %u", type);
3068
3069 if (!pt->typisdefined)
3070 ereport(ERROR,
3072 errmsg("type %s is only a shell",
3073 format_type_be(type))));
3074 if (!OidIsValid(pt->typoutput))
3075 ereport(ERROR,
3077 errmsg("no output function available for type %s",
3078 format_type_be(type))));
3079
3080 *typOutput = pt->typoutput;
3081 *typIsVarlena = (!pt->typbyval) && (pt->typlen == -1);
3082
3084}

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

1588{
1589 bool result = false;
1590 HeapTuple tp;
1591 TypeCacheEntry *typentry;
1592
1593 /* As in op_mergejoinable, let the typcache handle the hard cases */
1594 if (opno == ARRAY_EQ_OP)
1595 {
1596 typentry = lookup_type_cache(inputtype, TYPECACHE_HASH_PROC);
1597 if (typentry->hash_proc == F_HASH_ARRAY)
1598 result = true;
1599 }
1600 else if (opno == RECORD_EQ_OP)
1601 {
1602 typentry = lookup_type_cache(inputtype, TYPECACHE_HASH_PROC);
1603 if (typentry->hash_proc == F_HASH_RECORD)
1604 result = true;
1605 }
1606 else
1607 {
1608 /* For all other operators, rely on pg_operator.oprcanhash */
1610 if (HeapTupleIsValid(tp))
1611 {
1613
1614 result = optup->oprcanhash;
1615 ReleaseSysCache(tp);
1616 }
1617 }
1618 return result;
1619}
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 1508 of file lsyscache.c.

1509{
1510 HeapTuple tp;
1512
1514 if (!HeapTupleIsValid(tp)) /* shouldn't happen */
1515 elog(ERROR, "cache lookup failed for operator %u", opno);
1517 *lefttype = optup->oprleft;
1518 *righttype = optup->oprright;
1519 ReleaseSysCache(tp);
1520}

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_mergejoinable()

bool op_mergejoinable ( Oid  opno,
Oid  inputtype 
)
extern

Definition at line 1536 of file lsyscache.c.

1537{
1538 bool result = false;
1539 HeapTuple tp;
1540 TypeCacheEntry *typentry;
1541
1542 /*
1543 * For array_eq or record_eq, we can sort if the element or field types
1544 * are all sortable. We could implement all the checks for that here, but
1545 * the typcache already does that and caches the results too, so let's
1546 * rely on the typcache.
1547 */
1548 if (opno == ARRAY_EQ_OP)
1549 {
1550 typentry = lookup_type_cache(inputtype, TYPECACHE_CMP_PROC);
1551 if (typentry->cmp_proc == F_BTARRAYCMP)
1552 result = true;
1553 }
1554 else if (opno == RECORD_EQ_OP)
1555 {
1556 typentry = lookup_type_cache(inputtype, TYPECACHE_CMP_PROC);
1557 if (typentry->cmp_proc == F_BTRECORDCMP)
1558 result = true;
1559 }
1560 else
1561 {
1562 /* For all other operators, rely on pg_operator.oprcanmerge */
1564 if (HeapTupleIsValid(tp))
1565 {
1567
1568 result = optup->oprcanmerge;
1569 ReleaseSysCache(tp);
1570 }
1571 }
1572 return result;
1573}
#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 1627 of file lsyscache.c.

1628{
1629 RegProcedure funcid = get_opcode(opno);
1630
1631 if (funcid == (RegProcedure) InvalidOid)
1632 elog(ERROR, "operator %u does not exist", opno);
1633
1634 return func_strict((Oid) funcid);
1635}
RegProcedure get_opcode(Oid opno)
Definition lsyscache.c:1435
bool func_strict(Oid funcid)
Definition lsyscache.c:1911

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

1644{
1645 RegProcedure funcid = get_opcode(opno);
1646
1647 if (funcid == (RegProcedure) InvalidOid)
1648 elog(ERROR, "operator %u does not exist", opno);
1649
1650 return func_volatile((Oid) funcid);
1651}
char func_volatile(Oid funcid)
Definition lsyscache.c:1930

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

2831{
2832 return (get_typtype(typid) == TYPTYPE_ENUM);
2833}
char get_typtype(Oid typid)
Definition lsyscache.c:2781

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

Referenced by get_attavgwidth().