PostgreSQL Source Code
git master
|
#include "parser/parse_node.h"
Go to the source code of this file.
Typedefs | |
typedef char | TYPCATEGORY |
typedef enum CoercionPathType | CoercionPathType |
Enumerations | |
enum | CoercionPathType { COERCION_PATH_NONE , COERCION_PATH_FUNC , COERCION_PATH_RELABELTYPE , COERCION_PATH_ARRAYCOERCE , COERCION_PATH_COERCEVIAIO } |
Functions | |
bool | IsBinaryCoercible (Oid srctype, Oid targettype) |
bool | IsBinaryCoercibleWithCast (Oid srctype, Oid targettype, Oid *castoid) |
bool | IsPreferredType (TYPCATEGORY category, Oid type) |
TYPCATEGORY | TypeCategory (Oid type) |
Node * | coerce_to_target_type (ParseState *pstate, Node *expr, Oid exprtype, Oid targettype, int32 targettypmod, CoercionContext ccontext, CoercionForm cformat, int location) |
bool | can_coerce_type (int nargs, const Oid *input_typeids, const Oid *target_typeids, CoercionContext ccontext) |
Node * | coerce_type (ParseState *pstate, Node *node, Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod, CoercionContext ccontext, CoercionForm cformat, int location) |
Node * | coerce_to_domain (Node *arg, Oid baseTypeId, int32 baseTypeMod, Oid typeId, CoercionContext ccontext, CoercionForm cformat, int location, bool hideInputCoercion) |
Node * | coerce_to_boolean (ParseState *pstate, Node *node, const char *constructName) |
Node * | coerce_to_specific_type (ParseState *pstate, Node *node, Oid targetTypeId, const char *constructName) |
Node * | coerce_to_specific_type_typmod (ParseState *pstate, Node *node, Oid targetTypeId, int32 targetTypmod, const char *constructName) |
int | parser_coercion_errposition (ParseState *pstate, int coerce_location, Node *input_expr) |
Oid | select_common_type (ParseState *pstate, List *exprs, const char *context, Node **which_expr) |
Node * | coerce_to_common_type (ParseState *pstate, Node *node, Oid targetTypeId, const char *context) |
bool | verify_common_type (Oid common_type, List *exprs) |
int32 | select_common_typmod (ParseState *pstate, List *exprs, Oid common_type) |
bool | check_generic_type_consistency (const Oid *actual_arg_types, const Oid *declared_arg_types, int nargs) |
Oid | enforce_generic_type_consistency (const Oid *actual_arg_types, Oid *declared_arg_types, int nargs, Oid rettype, bool allow_poly) |
char * | check_valid_polymorphic_signature (Oid ret_type, const Oid *declared_arg_types, int nargs) |
char * | check_valid_internal_signature (Oid ret_type, const Oid *declared_arg_types, int nargs) |
CoercionPathType | find_coercion_pathway (Oid targetTypeId, Oid sourceTypeId, CoercionContext ccontext, Oid *funcid) |
CoercionPathType | find_typmod_coercion_function (Oid typeId, Oid *funcid) |
typedef enum CoercionPathType CoercionPathType |
typedef char TYPCATEGORY |
Definition at line 21 of file parse_coerce.h.
enum CoercionPathType |
Enumerator | |
---|---|
COERCION_PATH_NONE | |
COERCION_PATH_FUNC | |
COERCION_PATH_RELABELTYPE | |
COERCION_PATH_ARRAYCOERCE | |
COERCION_PATH_COERCEVIAIO |
Definition at line 24 of file parse_coerce.h.
bool can_coerce_type | ( | int | nargs, |
const Oid * | input_typeids, | ||
const Oid * | target_typeids, | ||
CoercionContext | ccontext | ||
) |
Definition at line 556 of file parse_coerce.c.
References check_generic_type_consistency(), COERCION_PATH_NONE, find_coercion_pathway(), i, is_complex_array(), ISCOMPLEX, typeInheritsFrom(), and typeIsOfTypedTable().
Referenced by ATAddForeignKeyConstraint(), coerce_to_common_type(), coerce_to_target_type(), func_match_argtypes(), func_select_candidate(), jsonb_subscript_transform(), select_common_type(), select_common_type_from_oids(), transformFrameOffset(), verify_common_type(), and verify_common_type_from_oids().
bool check_generic_type_consistency | ( | const Oid * | actual_arg_types, |
const Oid * | declared_arg_types, | ||
int | nargs | ||
) |
Definition at line 1702 of file parse_coerce.c.
References Assert, FUNC_MAX_ARGS, get_element_type(), get_multirange_range(), get_range_subtype(), getBaseType(), InvalidOid, j, OidIsValid, select_common_type_from_oids(), type_is_array_domain, type_is_enum(), and verify_common_type_from_oids().
Referenced by can_coerce_type().
Definition at line 2917 of file parse_coerce.c.
References _, i, and pstrdup().
Referenced by AggregateCreate(), and ProcedureCreate().
Definition at line 2840 of file parse_coerce.c.
References _, format_type_be(), i, and psprintf().
Referenced by AggregateCreate(), and ProcedureCreate().
Node* coerce_to_boolean | ( | ParseState * | pstate, |
Node * | node, | ||
const char * | constructName | ||
) |
Definition at line 1161 of file parse_coerce.c.
References COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, ereport, errcode(), errmsg(), ERROR, expression_returns_set(), exprLocation(), exprType(), format_type_be(), and parser_errposition().
Referenced by cookConstraint(), DoCopy(), domainAddCheckConstraint(), transformAExprIn(), transformBooleanTest(), transformBoolExpr(), transformCaseExpr(), transformJoinUsingClause(), transformWhereClause(), and transformXmlExpr().
Node* coerce_to_common_type | ( | ParseState * | pstate, |
Node * | node, | ||
Oid | targetTypeId, | ||
const char * | context | ||
) |
Definition at line 1537 of file parse_coerce.c.
References can_coerce_type(), COERCE_IMPLICIT_CAST, coerce_type(), COERCION_IMPLICIT, context, ereport, errcode(), errmsg(), ERROR, exprLocation(), exprType(), format_type_be(), and parser_errposition().
Referenced by analyzeCTE(), generate_setop_tlist(), transformAExprIn(), transformArrayExpr(), transformCaseExpr(), transformCoalesceExpr(), transformMinMaxExpr(), transformSetOperationTree(), and transformValuesClause().
Node* coerce_to_domain | ( | Node * | arg, |
Oid | baseTypeId, | ||
int32 | baseTypeMod, | ||
Oid | typeId, | ||
CoercionContext | ccontext, | ||
CoercionForm | cformat, | ||
int | location, | ||
bool | hideInputCoercion | ||
) |
Definition at line 676 of file parse_coerce.c.
References arg, CoerceToDomain::arg, COERCE_IMPLICIT_CAST, coerce_type_typmod(), getBaseTypeAndTypmod(), hide_coercion_node(), InvalidOid, CoerceToDomain::location, makeNode, and CoerceToDomain::resulttype.
Referenced by coerce_record_to_complex(), coerce_type(), expand_insert_targetlist(), ReplaceVarsFromTargetList_callback(), rewriteTargetListIU(), rewriteValuesRTE(), and transformAssignmentIndirection().
Node* coerce_to_specific_type | ( | ParseState * | pstate, |
Node * | node, | ||
Oid | targetTypeId, | ||
const char * | constructName | ||
) |
Definition at line 1257 of file parse_coerce.c.
References coerce_to_specific_type_typmod().
Referenced by coerceJsonFuncExpr(), interpret_function_parameter_list(), transformFrameOffset(), transformJsonScalarExpr(), transformJsonValueExpr(), transformLimitClause(), transformRangeTableFunc(), transformRangeTableSample(), transformXmlExpr(), and transformXmlSerialize().
Node* coerce_to_specific_type_typmod | ( | ParseState * | pstate, |
Node * | node, | ||
Oid | targetTypeId, | ||
int32 | targetTypmod, | ||
const char * | constructName | ||
) |
Definition at line 1208 of file parse_coerce.c.
References COERCE_IMPLICIT_CAST, coerce_to_target_type(), COERCION_ASSIGNMENT, ereport, errcode(), errmsg(), ERROR, expression_returns_set(), exprLocation(), exprType(), format_type_be(), and parser_errposition().
Referenced by coerce_to_specific_type(), and transformRangeTableFunc().
Node* coerce_to_target_type | ( | ParseState * | pstate, |
Node * | expr, | ||
Oid | exprtype, | ||
Oid | targettype, | ||
int32 | targettypmod, | ||
CoercionContext | ccontext, | ||
CoercionForm | cformat, | ||
int | location | ||
) |
Definition at line 78 of file parse_coerce.c.
References arg, CollateExpr::arg, can_coerce_type(), coerce_type(), coerce_type_typmod(), CollateExpr::collOid, IsA, CollateExpr::location, makeNode, and type_is_collatable().
Referenced by array_subscript_transform(), ATExecAddColumn(), ATExecAlterColumnType(), ATPrepAlterColumnType(), build_coercion_expression(), build_column_default(), coerce_fn_result_column(), coerce_record_to_complex(), coerce_to_boolean(), coerce_to_specific_type_typmod(), coerceJsonFuncExpr(), cookDefault(), EvaluateParams(), get_cast_hashentry(), hstore_subscript_transform(), transformArrayExpr(), transformAssignedExpr(), transformAssignmentIndirection(), transformAssignmentSubscripts(), transformJsonBehavior(), transformJsonFuncExpr(), transformJsonParseArg(), transformJsonValueExpr(), transformPartitionBoundValue(), transformPLAssignStmt(), transformTypeCast(), and transformXmlSerialize().
Node* coerce_type | ( | ParseState * | pstate, |
Node * | node, | ||
Oid | inputTypeId, | ||
Oid | targetTypeId, | ||
int32 | targetTypeMod, | ||
CoercionContext | ccontext, | ||
CoercionForm | cformat, | ||
int | location | ||
) |
Definition at line 157 of file parse_coerce.c.
References ConvertRowtypeExpr::arg, CollateExpr::arg, build_coercion_expression(), cancel_parser_errposition_callback(), COERCE_IMPLICIT_CAST, coerce_record_to_complex(), coerce_to_domain(), COERCION_PATH_NONE, COERCION_PATH_RELABELTYPE, CollateExpr::collOid, Const::consttype, DatumGetCString(), datumIsEqual(), elog, ERROR, find_coercion_pathway(), format_type_be(), getBaseType(), getBaseTypeAndTypmod(), InvalidOid, is_complex_array(), IsA, ISCOMPLEX, RelabelType::location, ConvertRowtypeExpr::location, CollateExpr::location, makeNode, makeRelabelType(), ParseState::p_coerce_param_hook, PG_DETOAST_DATUM, PointerGetDatum(), ReleaseSysCache(), ConvertRowtypeExpr::resulttype, setup_parser_errposition_callback(), stringTypeDatum(), type_is_collatable(), typeByVal(), typeidType(), typeInheritsFrom(), typeIsOfTypedTable(), typeLen(), typeTypeCollation(), typeTypeName(), and WARNING.
Referenced by addTargetToGroupList(), addTargetToSortList(), buildMergedJoinVar(), coerce_to_common_type(), coerce_to_target_type(), jsonb_subscript_transform(), make_fn_arguments(), ParseFuncOrColumn(), resolveTargetListUnknowns(), transformArrayExpr(), and unify_hypothetical_args().
Oid enforce_generic_type_consistency | ( | const Oid * | actual_arg_types, |
Oid * | declared_arg_types, | ||
int | nargs, | ||
Oid | rettype, | ||
bool | allow_poly | ||
) |
Definition at line 2096 of file parse_coerce.c.
References Assert, ereport, errcode(), errdetail(), errmsg(), errmsg_internal(), ERROR, format_type_be(), FUNC_MAX_ARGS, get_array_type(), get_element_type(), get_multirange_range(), get_range_multirange(), get_range_subtype(), getBaseType(), InvalidOid, j, OidIsValid, select_common_type_from_oids(), type_is_array_domain, type_is_enum(), and verify_common_type_from_oids().
Referenced by lookup_agg_function(), make_op(), make_scalar_array_op(), ParseFuncOrColumn(), recheck_cast_function_args(), and resolve_aggregate_transtype().
CoercionPathType find_coercion_pathway | ( | Oid | targetTypeId, |
Oid | sourceTypeId, | ||
CoercionContext | ccontext, | ||
Oid * | funcid | ||
) |
Definition at line 3118 of file parse_coerce.c.
References COERCION_ASSIGNMENT, COERCION_EXPLICIT, COERCION_IMPLICIT, COERCION_PATH_ARRAYCOERCE, COERCION_PATH_COERCEVIAIO, COERCION_PATH_FUNC, COERCION_PATH_NONE, COERCION_PATH_RELABELTYPE, COERCION_PLPGSQL, elog, ERROR, get_element_type(), getBaseType(), GETSTRUCT, HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache2(), and TypeCategory().
Referenced by can_coerce_type(), coerce_type(), findFkeyCast(), func_get_detail(), json_categorize_type(), and ri_HashCompareOp().
CoercionPathType find_typmod_coercion_function | ( | Oid | typeId, |
Oid * | funcid | ||
) |
Definition at line 3281 of file parse_coerce.c.
References COERCION_PATH_ARRAYCOERCE, COERCION_PATH_FUNC, COERCION_PATH_NONE, GETSTRUCT, HeapTupleIsValid, InvalidOid, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache2(), and typeidType().
Referenced by coerce_type_typmod().
Definition at line 2995 of file parse_coerce.c.
References IsBinaryCoercibleWithCast().
Referenced by AggregateCreate(), binary_coercible(), check_amproc_signature(), compatible_oper(), ExecInitAgg(), findRangeSubOpclass(), GetDefaultOpClass(), initialize_peragg(), lookup_agg_function(), ResolveOpClass(), ri_HashCompareOp(), satisfies_hash_partition(), spgGetCache(), ts_stat_sql(), tsvector_update_trigger(), and tupledesc_match().
Definition at line 3010 of file parse_coerce.c.
References getBaseType(), GETSTRUCT, HeapTupleIsValid, InvalidOid, is_complex_array(), ISCOMPLEX, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), SearchSysCache2(), type_is_array, type_is_enum(), type_is_multirange(), and type_is_range().
Referenced by CreateCast(), and IsBinaryCoercible().
bool IsPreferredType | ( | TYPCATEGORY | category, |
Oid | type | ||
) |
Definition at line 2960 of file parse_coerce.c.
References get_type_category_preferred(), and type.
Referenced by func_select_candidate(), and GetDefaultOpClass().
int parser_coercion_errposition | ( | ParseState * | pstate, |
int | coerce_location, | ||
Node * | input_expr | ||
) |
Definition at line 1277 of file parse_coerce.c.
References exprLocation(), and parser_errposition().
Referenced by coerce_record_to_complex(), coerceJsonFuncExpr(), and transformTypeCast().
Oid select_common_type | ( | ParseState * | pstate, |
List * | exprs, | ||
const char * | context, | ||
Node ** | which_expr | ||
) |
Definition at line 1307 of file parse_coerce.c.
References Assert, can_coerce_type(), COERCION_IMPLICIT, context, ereport, errcode(), errmsg(), ERROR, exprLocation(), exprType(), for_each_cell, format_type_be(), get_type_category_preferred(), getBaseType(), InvalidOid, lfirst, linitial, list_second_cell(), NIL, and parser_errposition().
Referenced by analyzeCTE(), buildMergedJoinVar(), transformAExprIn(), transformArrayExpr(), transformCaseExpr(), transformCoalesceExpr(), transformMinMaxExpr(), transformSetOperationTree(), transformValuesClause(), and unify_hypothetical_args().
int32 select_common_typmod | ( | ParseState * | pstate, |
List * | exprs, | ||
Oid | common_type | ||
) |
Definition at line 1609 of file parse_coerce.c.
References exprType(), exprTypmod(), and lfirst.
Referenced by analyzeCTE(), buildMergedJoinVar(), transformSetOperationTree(), transformValuesClause(), and unify_hypothetical_args().
TYPCATEGORY TypeCategory | ( | Oid | type | ) |
Definition at line 2941 of file parse_coerce.c.
References Assert, get_type_category_preferred(), and type.
Referenced by find_coercion_pathway(), func_get_detail(), func_select_candidate(), GetDefaultOpClass(), and transformJsonBehavior().
Definition at line 1571 of file parse_coerce.c.
References can_coerce_type(), COERCION_IMPLICIT, exprType(), and lfirst.
Referenced by transformAExprIn().