#include "nodes/parsenodes.h"
Go to the source code of this file.
Functions | |
A_Expr * | makeA_Expr (A_Expr_Kind kind, List *name, Node *lexpr, Node *rexpr, int location) |
A_Expr * | makeSimpleA_Expr (A_Expr_Kind kind, char *name, Node *lexpr, Node *rexpr, int location) |
Var * | makeVar (Index varno, AttrNumber varattno, Oid vartype, int32 vartypmod, Oid varcollid, Index varlevelsup) |
Var * | makeVarFromTargetEntry (Index varno, TargetEntry *tle) |
Var * | makeWholeRowVar (RangeTblEntry *rte, Index varno, Index varlevelsup, bool allowScalar) |
TargetEntry * | makeTargetEntry (Expr *expr, AttrNumber resno, char *resname, bool resjunk) |
TargetEntry * | flatCopyTargetEntry (TargetEntry *src_tle) |
FromExpr * | makeFromExpr (List *fromlist, Node *quals) |
Const * | makeConst (Oid consttype, int32 consttypmod, Oid constcollid, int constlen, Datum constvalue, bool constisnull, bool constbyval) |
Const * | makeNullConst (Oid consttype, int32 consttypmod, Oid constcollid) |
Node * | makeBoolConst (bool value, bool isnull) |
Expr * | makeBoolExpr (BoolExprType boolop, List *args, int location) |
Alias * | makeAlias (const char *aliasname, List *colnames) |
RelabelType * | makeRelabelType (Expr *arg, Oid rtype, int32 rtypmod, Oid rcollid, CoercionForm rformat) |
RangeVar * | makeRangeVar (char *schemaname, char *relname, int location) |
TypeName * | makeTypeName (char *typnam) |
TypeName * | makeTypeNameFromNameList (List *names) |
TypeName * | makeTypeNameFromOid (Oid typeOid, int32 typmod) |
FuncExpr * | makeFuncExpr (Oid funcid, Oid rettype, List *args, Oid funccollid, Oid inputcollid, CoercionForm fformat) |
DefElem * | makeDefElem (char *name, Node *arg) |
DefElem * | makeDefElemExtended (char *nameSpace, char *name, Node *arg, DefElemAction defaction) |
TargetEntry* flatCopyTargetEntry | ( | TargetEntry * | src_tle | ) |
Definition at line 245 of file makefuncs.c.
References Assert, IsA, and makeNode.
Referenced by expand_targetlist(), process_matched_tle(), rewriteTargetListIU(), set_dummy_tlist_references(), and set_upper_references().
{ TargetEntry *tle = makeNode(TargetEntry); Assert(IsA(src_tle, TargetEntry)); memcpy(tle, src_tle, sizeof(TargetEntry)); return tle; }
A_Expr* makeA_Expr | ( | A_Expr_Kind | kind, | |
List * | name, | |||
Node * | lexpr, | |||
Node * | rexpr, | |||
int | location | |||
) |
Definition at line 30 of file makefuncs.c.
References A_Expr::kind, A_Expr::lexpr, A_Expr::location, makeNode, A_Expr::name, and A_Expr::rexpr.
Referenced by transformJoinUsingClause().
Definition at line 353 of file makefuncs.c.
References Alias::aliasname, Alias::colnames, makeNode, and pstrdup().
Referenced by addRangeTableEntry(), addRangeTableEntryForCTE(), addRangeTableEntryForFunction(), addRangeTableEntryForJoin(), addRangeTableEntryForRelation(), addRangeTableEntryForValues(), convert_ANY_sublink_to_join(), CreateTrigger(), deparse_context_for(), pg_get_triggerdef_worker(), transformInsertStmt(), transformRuleStmt(), transformSetOperationTree(), and UpdateRangeTableOfViewParse().
Definition at line 323 of file makefuncs.c.
References BoolGetDatum, BOOLOID, InvalidOid, and makeConst().
Referenced by clause_selectivity(), create_append_plan(), eval_const_expressions_mutator(), expand_boolean_index_clause(), inheritance_planner(), make_ands_explicit(), make_row_distinct_op(), negate_clause(), and transformAExprOf().
{ /* note that pg_type.h hardwires size of bool as 1 ... duplicate it */ return (Node *) makeConst(BOOLOID, -1, InvalidOid, 1, BoolGetDatum(value), isnull, true); }
Expr* makeBoolExpr | ( | BoolExprType | boolop, | |
List * | args, | |||
int | location | |||
) |
Definition at line 335 of file makefuncs.c.
References BoolExpr::args, BoolExpr::boolop, BoolExpr::location, and makeNode.
Referenced by make_row_comparison_op(), make_row_distinct_op(), transformAExprAnd(), transformAExprIn(), transformAExprNot(), and transformAExprOr().
Const* makeConst | ( | Oid | consttype, | |
int32 | consttypmod, | |||
Oid | constcollid, | |||
int | constlen, | |||
Datum | constvalue, | |||
bool | constisnull, | |||
bool | constbyval | |||
) |
Definition at line 273 of file makefuncs.c.
References Const::constbyval, Const::constcollid, Const::constisnull, Const::constlen, Const::consttype, Const::consttypmod, Const::constvalue, Const::location, and makeNode.
Referenced by build_coercion_expression(), build_minmax_path(), check_sql_fn_retval(), eval_const_expressions_mutator(), evaluate_expr(), expand_targetlist(), generate_setop_tlist(), get_typdefault(), make_const(), makeBoolConst(), makeNullConst(), network_prefix_quals(), rewriteTargetListIU(), rewriteValuesRTE(), scalararraysel(), string_to_bytea_const(), string_to_const(), and transformArraySubscripts().
{ Const *cnst = makeNode(Const); cnst->consttype = consttype; cnst->consttypmod = consttypmod; cnst->constcollid = constcollid; cnst->constlen = constlen; cnst->constvalue = constvalue; cnst->constisnull = constisnull; cnst->constbyval = constbyval; cnst->location = -1; /* "unknown" */ return cnst; }
Definition at line 482 of file makefuncs.c.
References DefElem::arg, DefElem::defaction, DefElem::defname, DefElem::defnamespace, and makeNode.
Referenced by defWithOids(), deserialize_deflist(), fileGetForeignPaths(), get_file_fdw_attribute_options(), transformColumnDefinition(), and untransformRelOptions().
DefElem* makeDefElemExtended | ( | char * | nameSpace, | |
char * | name, | |||
Node * | arg, | |||
DefElemAction | defaction | |||
) |
Definition at line 499 of file makefuncs.c.
References DefElem::arg, DefElem::defaction, DefElem::defname, DefElem::defnamespace, and makeNode.
Definition at line 259 of file makefuncs.c.
References FromExpr::fromlist, makeNode, and FromExpr::quals.
Referenced by pull_up_sublinks(), pull_up_sublinks_jointree_recurse(), transformDeleteStmt(), transformRuleStmt(), transformSelectStmt(), transformSetOperationStmt(), transformUpdateStmt(), and transformValuesClause().
FuncExpr* makeFuncExpr | ( | Oid | funcid, | |
Oid | rettype, | |||
List * | args, | |||
Oid | funccollid, | |||
Oid | inputcollid, | |||
CoercionForm | fformat | |||
) |
Definition at line 455 of file makefuncs.c.
References FuncExpr::args, FuncExpr::funccollid, FuncExpr::funcformat, FuncExpr::funcid, FuncExpr::funcresulttype, FuncExpr::funcretset, FuncExpr::funcvariadic, FuncExpr::inputcollid, FuncExpr::location, and makeNode.
Referenced by build_aggregate_fnexprs(), and build_coercion_expression().
{ FuncExpr *funcexpr; funcexpr = makeNode(FuncExpr); funcexpr->funcid = funcid; funcexpr->funcresulttype = rettype; funcexpr->funcretset = false; /* only allowed case here */ funcexpr->funcvariadic = false; /* only allowed case here */ funcexpr->funcformat = fformat; funcexpr->funccollid = funccollid; funcexpr->inputcollid = inputcollid; funcexpr->args = args; funcexpr->location = -1; return funcexpr; }
Definition at line 303 of file makefuncs.c.
References get_typlenbyval(), and makeConst().
Referenced by AcquireRewriteLocks(), ATExecAddColumn(), coerce_record_to_complex(), eval_const_expressions_mutator(), evaluate_function(), ExecInitExpr(), expandTupleDesc(), ReplaceVarsFromTargetList_callback(), and transformAssignedExpr().
{ int16 typLen; bool typByVal; get_typlenbyval(consttype, &typLen, &typByVal); return makeConst(consttype, consttypmod, constcollid, (int) typLen, (Datum) 0, true, typByVal); }
RangeVar* makeRangeVar | ( | char * | schemaname, | |
char * | relname, | |||
int | location | |||
) |
Definition at line 388 of file makefuncs.c.
References RangeVar::alias, RangeVar::catalogname, RangeVar::inhOpt, RangeVar::location, makeNode, RangeVar::relname, RangeVar::relpersistence, and RangeVar::schemaname.
Referenced by AlterTableNamespace(), boot_openrel(), BootstrapToastTable(), ConvertTriggerToFK(), createForeignKeyTriggers(), ExpandColumnRefStar(), index_constraint_create(), LookupTypeName(), makeRangeVarFromNameList(), plpgsql_parse_cwordrowtype(), plpgsql_parse_cwordtype(), pltcl_init_load_unknown(), transformColumnDefinition(), and transformColumnRef().
{ RangeVar *r = makeNode(RangeVar); r->catalogname = NULL; r->schemaname = schemaname; r->relname = relname; r->inhOpt = INH_DEFAULT; r->relpersistence = RELPERSISTENCE_PERMANENT; r->alias = NULL; r->location = location; return r; }
RelabelType* makeRelabelType | ( | Expr * | arg, | |
Oid | rtype, | |||
int32 | rtypmod, | |||
Oid | rcollid, | |||
CoercionForm | rformat | |||
) |
Definition at line 368 of file makefuncs.c.
References RelabelType::arg, RelabelType::location, makeNode, RelabelType::relabelformat, RelabelType::resultcollid, RelabelType::resulttype, and RelabelType::resulttypmod.
Referenced by buildMergedJoinVar(), canonicalize_ec_expression(), check_sql_fn_retval(), coerce_type(), generate_setop_tlist(), and relabel_to_typmod().
{ RelabelType *r = makeNode(RelabelType); r->arg = arg; r->resulttype = rtype; r->resulttypmod = rtypmod; r->resultcollid = rcollid; r->relabelformat = rformat; r->location = -1; return r; }
A_Expr* makeSimpleA_Expr | ( | A_Expr_Kind | kind, | |
char * | name, | |||
Node * | lexpr, | |||
Node * | rexpr, | |||
int | location | |||
) |
Definition at line 48 of file makefuncs.c.
References A_Expr::kind, A_Expr::lexpr, list_make1, A_Expr::location, makeNode, makeString(), A_Expr::name, and A_Expr::rexpr.
Referenced by transformCaseExpr(), and transformJoinUsingClause().
TargetEntry* makeTargetEntry | ( | Expr * | expr, | |
AttrNumber | resno, | |||
char * | resname, | |||
bool | resjunk | |||
) |
Definition at line 212 of file makefuncs.c.
References TargetEntry::expr, makeNode, TargetEntry::resjunk, TargetEntry::resname, TargetEntry::resno, TargetEntry::resorigcol, TargetEntry::resorigtbl, and TargetEntry::ressortgroupref.
Referenced by add_to_flat_tlist(), build_index_tlist(), build_minmax_path(), build_physical_tlist(), build_relation_tlist(), check_sql_fn_retval(), convert_EXISTS_to_ANY(), create_unique_plan(), determineRecursiveColTypes(), ExecInitSubPlan(), expand_targetlist(), expandRelAttrs(), ExpandRowReference(), generate_append_tlist(), generate_setop_tlist(), make_subplanTargetList(), make_windowInputTargetList(), postgresAddForeignUpdateTargets(), prepare_sort_from_pathkeys(), preprocess_targetlist(), rewriteTargetListIU(), rewriteTargetListUD(), transformAggregateCall(), transformSetOperationStmt(), transformSetOperationTree(), and transformTargetEntry().
{ TargetEntry *tle = makeNode(TargetEntry); tle->expr = expr; tle->resno = resno; tle->resname = resname; /* * We always set these fields to 0. If the caller wants to change them he * must do so explicitly. Few callers do that, so omitting these * arguments reduces the chance of error. */ tle->ressortgroupref = 0; tle->resorigtbl = InvalidOid; tle->resorigcol = 0; tle->resjunk = resjunk; return tle; }
TypeName* makeTypeName | ( | char * | typnam | ) |
Definition at line 410 of file makefuncs.c.
References list_make1, makeString(), and makeTypeNameFromNameList().
Referenced by plpgsql_parse_wordtype().
{ return makeTypeNameFromNameList(list_make1(makeString(typnam))); }
Definition at line 422 of file makefuncs.c.
References TypeName::location, makeNode, TypeName::names, TypeName::typemod, and TypeName::typmods.
Referenced by AlterDomainAddConstraint(), AlterDomainDefault(), AlterDomainDropConstraint(), AlterDomainNotNull(), AlterDomainValidateConstraint(), AlterEnum(), AlterTypeNamespace(), AlterTypeOwner(), defGetTypeName(), does_not_exist_skipping(), FuncNameAsType(), get_object_address_type(), makeTypeName(), objectNamesToOids(), RenameConstraint(), and RenameType().
Definition at line 438 of file makefuncs.c.
References TypeName::location, makeNode, TypeName::typemod, and TypeName::typeOid.
Referenced by ATPrepAddOids(), DefineSequence(), DefineVirtualRelation(), MergeAttributes(), transformOfType(), and transformTableLikeClause().
Var* makeVar | ( | Index | varno, | |
AttrNumber | varattno, | |||
Oid | vartype, | |||
int32 | vartypmod, | |||
Oid | varcollid, | |||
Index | varlevelsup | |||
) |
Definition at line 66 of file makefuncs.c.
References Var::location, makeNode, Var::varattno, Var::varcollid, Var::varlevelsup, Var::varno, Var::varnoold, Var::varoattno, Var::vartype, and Var::vartypmod.
Referenced by ATPrepAlterColumnType(), build_index_tlist(), build_physical_tlist(), eval_const_expressions_mutator(), expand_targetlist(), expandRTE(), expandTupleDesc(), fix_indexqual_operand(), generate_append_tlist(), generate_setop_tlist(), get_relation_constraints(), make_inh_translation_list(), make_var(), makeVarFromTargetEntry(), makeWholeRowVar(), postgresAddForeignUpdateTargets(), preprocess_targetlist(), rewriteTargetListIU(), rewriteTargetListUD(), set_dummy_tlist_references(), and transformSetOperationStmt().
{ Var *var = makeNode(Var); var->varno = varno; var->varattno = varattno; var->vartype = vartype; var->vartypmod = vartypmod; var->varcollid = varcollid; var->varlevelsup = varlevelsup; /* * Since few if any routines ever create Var nodes with varnoold/varoattno * different from varno/varattno, we don't provide separate arguments for * them, but just initialize them to the given varno/varattno. This * reduces code clutter and chance of error for most callers. */ var->varnoold = varno; var->varoattno = varattno; /* Likewise, we just set location to "unknown" here */ var->location = -1; return var; }
Var* makeVarFromTargetEntry | ( | Index | varno, | |
TargetEntry * | tle | |||
) |
Definition at line 103 of file makefuncs.c.
References TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), makeVar(), and TargetEntry::resno.
Referenced by build_physical_tlist(), convert_subquery_pathkeys(), generate_subquery_vars(), make_setop_translation_list(), search_indexed_tlist_for_non_var(), search_indexed_tlist_for_sortgroupref(), and transformInsertStmt().
Var* makeWholeRowVar | ( | RangeTblEntry * | rte, | |
Index | varno, | |||
Index | varlevelsup, | |||
bool | allowScalar | |||
) |
Definition at line 131 of file makefuncs.c.
References elog, ERROR, exprCollation(), exprType(), RangeTblEntry::funcexpr, get_rel_type_id(), InvalidAttrNumber, InvalidOid, makeVar(), OidIsValid, RECORDOID, RangeTblEntry::relid, RTE_FUNCTION, RTE_RELATION, RangeTblEntry::rtekind, and type_is_rowtype().
Referenced by preprocess_targetlist(), rewriteTargetListUD(), and transformWholeRowRef().
{ Var *result; Oid toid; switch (rte->rtekind) { case RTE_RELATION: /* relation: the rowtype is a named composite type */ toid = get_rel_type_id(rte->relid); if (!OidIsValid(toid)) elog(ERROR, "could not find type OID for relation %u", rte->relid); result = makeVar(varno, InvalidAttrNumber, toid, -1, InvalidOid, varlevelsup); break; case RTE_FUNCTION: toid = exprType(rte->funcexpr); if (type_is_rowtype(toid)) { /* func returns composite; same as relation case */ result = makeVar(varno, InvalidAttrNumber, toid, -1, InvalidOid, varlevelsup); } else if (allowScalar) { /* func returns scalar; just return its output as-is */ result = makeVar(varno, 1, toid, -1, exprCollation(rte->funcexpr), varlevelsup); } else { /* func returns scalar, but we want a composite result */ result = makeVar(varno, InvalidAttrNumber, RECORDOID, -1, InvalidOid, varlevelsup); } break; default: /* * RTE is a join, subselect, or VALUES. We represent this as a * whole-row Var of RECORD type. (Note that in most cases the Var * will be expanded to a RowExpr during planning, but that is not * our concern here.) */ result = makeVar(varno, InvalidAttrNumber, RECORDOID, -1, InvalidOid, varlevelsup); break; } return result; }