|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/htup_details.h"#include "access/nbtree.h"#include "access/table.h"#include "access/tsmapi.h"#include "catalog/catalog.h"#include "catalog/pg_am.h"#include "catalog/pg_amproc.h"#include "catalog/pg_constraint.h"#include "catalog/pg_type.h"#include "commands/defrem.h"#include "miscadmin.h"#include "nodes/makefuncs.h"#include "nodes/nodeFuncs.h"#include "optimizer/optimizer.h"#include "parser/analyze.h"#include "parser/parse_clause.h"#include "parser/parse_coerce.h"#include "parser/parse_collate.h"#include "parser/parse_expr.h"#include "parser/parse_func.h"#include "parser/parse_oper.h"#include "parser/parse_relation.h"#include "parser/parse_target.h"#include "parser/parse_type.h"#include "parser/parser.h"#include "rewrite/rewriteManip.h"#include "utils/builtins.h"#include "utils/catcache.h"#include "utils/lsyscache.h"#include "utils/rel.h"#include "utils/syscache.h"
Go to the source code of this file.
|
static |
Definition at line 3605 of file parse_clause.c.
References assignSortGroupRef(), cancel_parser_errposition_callback(), COERCE_IMPLICIT_CAST, coerce_type(), COERCION_IMPLICIT, exprType(), fb(), get_sort_group_operators(), InvalidOid, lappend(), makeNode, setup_parser_errposition_callback(), and targetIsInSortList().
Referenced by transformDistinctClause(), transformDistinctOnClause(), transformGroupClause(), and transformGroupClauseExpr().
| List * addTargetToSortList | ( | ParseState * | pstate, |
| TargetEntry * | tle, | ||
| List * | sortlist, | ||
| List * | targetlist, | ||
| SortBy * | sortby | ||
| ) |
Definition at line 3461 of file parse_clause.c.
References Assert, assignSortGroupRef(), cancel_parser_errposition_callback(), COERCE_IMPLICIT_CAST, coerce_type(), COERCION_IMPLICIT, compatible_oper_opid(), elog, ereport, errcode(), errhint(), errmsg(), ERROR, exprLocation(), exprType(), fb(), get_equality_op_for_ordering_op(), get_sort_group_operators(), InvalidOid, lappend(), llast, makeNode, NIL, OidIsValid, op_hashjoinable(), setup_parser_errposition_callback(), SORTBY_ASC, SORTBY_DEFAULT, SORTBY_DESC, SORTBY_NULLS_DEFAULT, SORTBY_NULLS_FIRST, SORTBY_NULLS_LAST, SORTBY_USING, strVal, and targetIsInSortList().
Referenced by transformAggregateCall(), and transformSortClause().
| Index assignSortGroupRef | ( | TargetEntry * | tle, |
| List * | tlist | ||
| ) |
Definition at line 3662 of file parse_clause.c.
Referenced by addTargetToGroupList(), addTargetToSortList(), build_minmax_path(), create_unique_paths(), generate_setop_child_grouplist(), and transformDistinctOnClause().
|
static |
Definition at line 1666 of file parse_clause.c.
References assign_expr_collations(), COERCE_IMPLICIT_CAST, coerce_type(), COERCION_IMPLICIT, elog, ERROR, fb(), InvalidOid, IsA, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, list_make2, makeNode, makeRelabelType(), select_common_type(), and select_common_typmod().
Referenced by transformFromClauseItem().
|
static |
Definition at line 1639 of file parse_clause.c.
References Assert, fb(), makeVar(), markNullableIfNeeded(), and Var::varreturningtype.
Referenced by extractRemainingColumns(), and transformFromClauseItem().
Definition at line 1925 of file parse_clause.c.
References contain_vars_of_level(), ereport, errcode(), errmsg(), ERROR, fb(), locate_var_of_level(), and parser_errposition().
Referenced by transformFrameOffset(), and transformLimitClause().
|
static |
Definition at line 1950 of file parse_clause.c.
References contain_aggs_of_level(), contain_windowfuncs(), elog, ereport, errcode(), errmsg(), ERROR, EXPR_KIND_DISTINCT_ON, EXPR_KIND_GROUP_BY, EXPR_KIND_ORDER_BY, fb(), locate_agg_of_level(), locate_windowfunc(), ParseState::p_hasAggs, ParseState::p_hasWindowFuncs, ParseExprKindName(), and parser_errposition().
Referenced by findTargetlistEntrySQL92().
|
static |
Definition at line 253 of file parse_clause.c.
References attnum, bms_add_member(), bms_is_member(), buildVarFromNSColumn(), fb(), lappend(), lappend_int(), lfirst, lfirst_int, and strVal.
Referenced by transformFromClauseItem().
|
static |
Definition at line 2006 of file parse_clause.c.
References castNode, checkTargetlistEntrySQL92(), colNameToVar(), equal(), ereport, errcode(), errmsg(), ERROR, EXPR_KIND_GROUP_BY, fb(), findTargetlistEntrySQL99(), intVal, IsA, lfirst, linitial, list_length(), name, ParseExprKindName(), parser_errposition(), and strVal.
Referenced by transformDistinctOnClause(), transformGroupClauseExpr(), and transformSortClause().
|
static |
Definition at line 2172 of file parse_clause.c.
References equal(), fb(), lappend(), lfirst, strip_implicit_coercions(), transformExpr(), and transformTargetEntry().
Referenced by findTargetlistEntrySQL92(), transformGroupClauseExpr(), and transformSortClause().
|
static |
Definition at line 3730 of file parse_clause.c.
References fb(), lfirst, and name.
Referenced by transformWindowDefinitions().
Definition at line 2258 of file parse_clause.c.
References RowExpr::args, check_stack_depth(), COERCE_IMPLICIT_CAST, fb(), flatten_grouping_sets(), GROUPING_SET_EMPTY, GROUPING_SET_SETS, IsA, lappend(), lfirst, list_concat(), makeGroupingSet(), NIL, and Node::type.
Referenced by flatten_grouping_sets(), and transformGroupClause().
Definition at line 3239 of file parse_clause.c.
References elog, ERROR, exprLocation(), fb(), forboth, lfirst, and lfirst_int.
Referenced by transformDistinctOnClause().
|
static |
Definition at line 1011 of file parse_clause.c.
References addRangeTableEntryForCTE(), addRangeTableEntryForENR(), fb(), RangeVar::relname, scanNameSpaceForCTE(), scanNameSpaceForENR(), and RangeVar::schemaname.
Referenced by transformFromClauseItem().
|
static |
Definition at line 1774 of file parse_clause.c.
References bms_add_member(), elog, ERROR, fb(), IsA, j, lappend(), lfirst, list_length(), list_nth_cell(), markRelsAsNulledBy(), nodeTag, and ParseState::p_nullingrels.
Referenced by markRelsAsNulledBy(), and transformFromClauseItem().
|
static |
Definition at line 3264 of file parse_clause.c.
References ereport, errcode(), errmsg(), ERROR, EXPR_KIND_INDEX_EXPRESSION, fb(), ColumnRef::fields, get_opclass_oid(), InferClause::indexElems, InvalidOid, lappend(), lfirst, list_make1, ColumnRef::location, InferClause::location, LookupCollation(), makeNode, makeString(), NIL, parse(), parser_errposition(), SORTBY_DEFAULT, SORTBY_NULLS_DEFAULT, and transformExpr().
Referenced by transformOnConflictArbiter().
Definition at line 1815 of file parse_clause.c.
References fb(), lfirst, and ParseNamespaceItem::p_cols_visible.
Referenced by transformFromClauseItem().
|
static |
Definition at line 1832 of file parse_clause.c.
References fb(), lfirst, and ParseNamespaceItem::p_lateral_only.
Referenced by transformFromClause(), transformFromClauseItem(), and transformJoinOnClause().
| int setTargetTable | ( | ParseState * | pstate, |
| RangeVar * | relation, | ||
| bool | inh, | ||
| bool | alsoSource, | ||
| AclMode | requiredPerms | ||
| ) |
Definition at line 178 of file parse_clause.c.
References addNSItemToQuery(), addRangeTableEntryForRelation(), RangeVar::alias, ereport, errcode(), errmsg(), ERROR, fb(), NoLock, ParseNamespaceItem::p_perminfo, ParseState::p_target_nsitem, ParseState::p_target_relation, parserOpenTable(), RangeVar::relname, RTEPermissionInfo::requiredPerms, RowExclusiveLock, scanNameSpaceForENR(), RangeVar::schemaname, and table_close().
Referenced by transformDeleteStmt(), transformInsertStmt(), transformMergeStmt(), and transformUpdateStmt().
| bool targetIsInSortList | ( | TargetEntry * | tle, |
| Oid | sortop, | ||
| List * | sortList | ||
| ) |
Definition at line 3703 of file parse_clause.c.
References fb(), get_commutator(), InvalidOid, and lfirst.
Referenced by addTargetToGroupList(), addTargetToSortList(), check_output_expressions(), examine_simple_variable(), targetIsInAllPartitionLists(), transformDistinctOnClause(), and transformGroupClauseExpr().
| List * transformDistinctClause | ( | ParseState * | pstate, |
| List ** | targetlist, | ||
| List * | sortClause, | ||
| bool | is_agg | ||
| ) |
Definition at line 3048 of file parse_clause.c.
References addTargetToGroupList(), copyObject, ereport, errcode(), errmsg(), ERROR, exprLocation(), fb(), get_sortgroupclause_tle(), lappend(), lfirst, NIL, and parser_errposition().
Referenced by transformAggregateCall(), and transformSelectStmt().
| List * transformDistinctOnClause | ( | ParseState * | pstate, |
| List * | distinctlist, | ||
| List ** | targetlist, | ||
| List * | sortClause | ||
| ) |
Definition at line 3132 of file parse_clause.c.
References addTargetToGroupList(), Assert, assignSortGroupRef(), copyObject, ereport, errcode(), errmsg(), ERROR, EXPR_KIND_DISTINCT_ON, exprLocation(), fb(), findTargetlistEntrySQL92(), forboth, get_matching_location(), get_sortgroupref_tle(), InvalidOid, lappend(), lappend_int(), lfirst, lfirst_int, list_member_int(), NIL, parser_errposition(), and targetIsInSortList().
Referenced by transformSelectStmt().
|
static |
Definition at line 3757 of file parse_clause.c.
References Assert, BTINRANGE_PROC, can_coerce_type(), checkExprIsVarFree(), coerce_to_specific_type(), COERCION_IMPLICIT, ereport, errcode(), errhint(), errmsg(), ERROR, EXPR_KIND_WINDOW_FRAME_GROUPS, EXPR_KIND_WINDOW_FRAME_RANGE, EXPR_KIND_WINDOW_FRAME_ROWS, exprLocation(), exprType(), fb(), format_type_be(), FRAMEOPTION_GROUPS, FRAMEOPTION_RANGE, FRAMEOPTION_ROWS, GETSTRUCT(), i, InvalidOid, ObjectIdGetDatum(), parser_errposition(), ReleaseCatCacheList(), SearchSysCacheList2, and transformExpr().
Referenced by transformWindowDefinitions().
| void transformFromClause | ( | ParseState * | pstate, |
| List * | frmList | ||
| ) |
Definition at line 112 of file parse_clause.c.
References checkNameSpaceConflicts(), fb(), lappend(), lfirst, list_concat(), ParseState::p_joinlist, ParseState::p_namespace, setNamespaceLateralState(), and transformFromClauseItem().
Referenced by transformDeleteStmt(), transformMergeStmt(), transformSelectStmt(), and transformUpdateStmt().
|
static |
Definition at line 1054 of file parse_clause.c.
References addRangeTableEntryForJoin(), Assert, buildMergedJoinVar(), buildVarFromNSColumn(), check_stack_depth(), checkNameSpaceConflicts(), elog, ereport, errcode(), errmsg(), ERROR, exprCollation(), exprLocation(), exprType(), exprTypmod(), extractRemainingColumns(), fb(), forboth, getNSItemForSpecialRelationTypes(), IsA, j, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_RIGHT, lappend(), lappend_int(), lfirst, lfirst_int, list_concat(), list_length(), list_make1, list_truncate(), makeNode, makeString(), markRelsAsNulledBy(), NIL, nodeTag, ParseState::p_joinexprs, ParseState::p_namespace, ParseState::p_rtable, ParseNamespaceColumn::p_varnosyn, palloc0(), palloc_object, parser_errposition(), RTE_RELATION, setNamespaceColumnVisibility(), setNamespaceLateralState(), strVal, transformFromClauseItem(), transformJoinOnClause(), transformJoinUsingClause(), transformJsonTable(), transformRangeFunction(), transformRangeSubselect(), transformRangeTableFunc(), transformRangeTableSample(), transformTableEntry(), and VAR_RETURNING_DEFAULT.
Referenced by transformFromClause(), and transformFromClauseItem().
| List * transformGroupClause | ( | ParseState * | pstate, |
| List * | grouplist, | ||
| bool | groupByAll, | ||
| List ** | groupingSets, | ||
| List ** | targetlist, | ||
| List * | sortClause, | ||
| ParseExprKind | exprKind, | ||
| bool | useSQL99 | ||
| ) |
Definition at line 2636 of file parse_clause.c.
References addTargetToGroupList(), Assert, bms_add_member(), contain_aggs_of_level(), contain_windowfuncs(), exprLocation(), fb(), flatten_grouping_sets(), foreach_ptr, GROUPING_SET_CUBE, GROUPING_SET_EMPTY, GROUPING_SET_ROLLUP, GROUPING_SET_SETS, GROUPING_SET_SIMPLE, IsA, lappend(), lfirst, list_make1, list_make1_int, makeGroupingSet(), NIL, ParseState::p_hasAggs, ParseState::p_hasWindowFuncs, transformGroupClauseExpr(), and transformGroupingSet().
Referenced by transformSelectStmt(), and transformWindowDefinitions().
|
static |
Definition at line 2367 of file parse_clause.c.
References addTargetToGroupList(), bms_is_member(), copyObject, exprLocation(), fb(), findTargetlistEntrySQL92(), findTargetlistEntrySQL99(), InvalidOid, lappend(), lfirst, and targetIsInSortList().
Referenced by transformGroupClause(), transformGroupClauseList(), and transformGroupingSet().
|
static |
Definition at line 2475 of file parse_clause.c.
References bms_add_member(), fb(), lappend_int(), lfirst, NIL, and transformGroupClauseExpr().
Referenced by transformGroupingSet().
|
static |
Definition at line 2528 of file parse_clause.c.
References Assert, ereport, errcode(), errmsg(), ERROR, exprLocation(), fb(), GROUPING_SET_CUBE, GROUPING_SET_SETS, GROUPING_SET_SIMPLE, IsA, lappend(), lfirst, list_length(), list_make1_int, makeGroupingSet(), NIL, parser_errposition(), transformGroupClauseExpr(), transformGroupClauseList(), and transformGroupingSet().
Referenced by transformGroupClause(), and transformGroupingSet().
|
static |
Definition at line 365 of file parse_clause.c.
References EXPR_KIND_JOIN_ON, fb(), j, ParseState::p_namespace, setNamespaceLateralState(), and transformWhereClause().
Referenced by transformFromClauseItem().
|
static |
Definition at line 306 of file parse_clause.c.
References AEXPR_OP, AND_EXPR, coerce_to_boolean(), copyObject, EXPR_KIND_JOIN_USING, fb(), forboth, lappend(), lfirst, linitial, list_length(), makeBoolExpr(), makeSimpleA_Expr(), markVarForSelectPriv(), NIL, and transformExpr().
Referenced by transformFromClauseItem().
| Node * transformLimitClause | ( | ParseState * | pstate, |
| Node * | clause, | ||
| ParseExprKind | exprKind, | ||
| const char * | constructName, | ||
| LimitOption | limitOption | ||
| ) |
Definition at line 1881 of file parse_clause.c.
References castNode, checkExprIsVarFree(), coerce_to_specific_type(), ereport, errcode(), errmsg(), ERROR, EXPR_KIND_LIMIT, fb(), IsA, LIMIT_OPTION_WITH_TIES, and transformExpr().
Referenced by transformSelectStmt(), transformSetOperationStmt(), and transformValuesClause().
| void transformOnConflictArbiter | ( | ParseState * | pstate, |
| OnConflictClause * | onConflictClause, | ||
| List ** | arbiterExpr, | ||
| Node ** | arbiterWhere, | ||
| Oid * | constraint | ||
| ) |
Definition at line 3365 of file parse_clause.c.
References ACL_SELECT, OnConflictClause::action, bms_add_members(), InferClause::conname, ereport, errcode(), errhint(), errmsg(), ERROR, EXPR_KIND_INDEX_PREDICATE, exprLocation(), fb(), get_relation_constraint_attnos(), InferClause::indexElems, OnConflictClause::infer, InvalidOid, IsCatalogRelation(), NIL, ONCONFLICT_UPDATE, ParseNamespaceItem::p_perminfo, ParseState::p_target_nsitem, ParseState::p_target_relation, parser_errposition(), RelationGetRelationName, RelationGetRelid, RelationIsUsedAsCatalogTable, resolve_unique_index_expr(), transformExpr(), and InferClause::whereClause.
Referenced by transformOnConflictClause().
|
static |
Definition at line 463 of file parse_clause.c.
References addRangeTableEntryForFunction(), arg, Assert, assign_list_collations(), COERCE_EXPLICIT_CALL, RangeFunction::coldeflist, contain_vars_of_level(), ereport, errcode(), errhint(), errmsg(), ERROR, EXPR_KIND_FROM_FUNCTION, exprLocation(), fb(), fc(), FigureColname(), RangeFunction::functions, RangeFunction::is_rowsfrom, IsA, lappend(), RangeFunction::lateral, lfirst, linitial, list_length(), list_make1, lsecond, makeFuncCall(), NIL, RangeFunction::ordinality, ParseState::p_last_srf, ParseState::p_lateral_active, parser_errposition(), strVal, SystemFuncName(), and transformExpr().
Referenced by transformFromClauseItem().
|
static |
Definition at line 405 of file parse_clause.c.
References addRangeTableEntryForSubquery(), RangeSubselect::alias, Alias::aliasname, Assert, CMD_SELECT, Query::commandType, elog, ERROR, EXPR_KIND_FROM_SUBSELECT, EXPR_KIND_NONE, fb(), IsA, isLockedRefname(), RangeSubselect::lateral, ParseState::p_expr_kind, ParseState::p_lateral_active, parse_sub_analyze(), and RangeSubselect::subquery.
Referenced by transformFromClauseItem().
|
static |
Definition at line 686 of file parse_clause.c.
References addRangeTableEntryForTableFunc(), Assert, assign_expr_collations(), bms_add_member(), coerce_to_specific_type(), coerce_to_specific_type_typmod(), TableFunc::colexprs, contain_vars_of_level(), TableFunc::docexpr, ereport, errcode(), errmsg(), ERROR, EXPR_KIND_FROM_FUNCTION, fb(), TableFunc::functype, get_typcollation(), IsA, j, lappend(), lappend_int(), lappend_oid(), lfirst, lfirst_node, list_length(), ResTarget::location, TableFunc::location, makeNode, makeString(), ResTarget::name, NIL, ParseState::p_lateral_active, palloc_array, parser_errposition(), pfree(), pstrdup(), TableFunc::rowexpr, strVal, TFT_XMLTABLE, transformExpr(), typenameTypeIdAndMod(), and ResTarget::val.
Referenced by transformFromClauseItem().
|
static |
Definition at line 908 of file parse_clause.c.
References arg, TableSampleClause::args, assign_expr_collations(), coerce_to_specific_type(), ereport, errcode(), errmsg(), errmsg_plural(), ERROR, EXPR_KIND_FROM_FUNCTION, fb(), forboth, get_func_rettype(), GetTsmRoutine(), lappend(), lfirst, lfirst_oid, list_length(), LookupFuncName(), makeNode, NameListToString(), NIL, OidIsValid, parser_errposition(), TableSampleClause::repeatable, transformExpr(), and TableSampleClause::tsmhandler.
Referenced by transformFromClauseItem().
| List * transformSortClause | ( | ParseState * | pstate, |
| List * | orderlist, | ||
| List ** | targetlist, | ||
| ParseExprKind | exprKind, | ||
| bool | useSQL99 | ||
| ) |
Definition at line 2794 of file parse_clause.c.
References addTargetToSortList(), fb(), findTargetlistEntrySQL92(), findTargetlistEntrySQL99(), lfirst, and NIL.
Referenced by transformAggregateCall(), transformSelectStmt(), transformSetOperationStmt(), transformValuesClause(), and transformWindowDefinitions().
|
static |
Definition at line 395 of file parse_clause.c.
References addRangeTableEntry(), RangeVar::alias, and RangeVar::inh.
Referenced by transformFromClauseItem().
| Node * transformWhereClause | ( | ParseState * | pstate, |
| Node * | clause, | ||
| ParseExprKind | exprKind, | ||
| const char * | constructName | ||
| ) |
Definition at line 1854 of file parse_clause.c.
References coerce_to_boolean(), fb(), and transformExpr().
Referenced by AlterPolicy(), CreatePolicy(), CreateTriggerFiringOn(), ParseFuncOrColumn(), test_rls_hooks_permissive(), test_rls_hooks_restrictive(), transformDeleteStmt(), transformIndexStmt(), transformJoinOnClause(), transformJsonAggConstructor(), transformMergeStmt(), transformOnConflictClause(), TransformPubWhereClauses(), transformRuleStmt(), transformSelectStmt(), and transformUpdateStmt().
| List * transformWindowDefinitions | ( | ParseState * | pstate, |
| List * | windowdefs, | ||
| List ** | targetlist | ||
| ) |
Definition at line 2827 of file parse_clause.c.
References copyObject, elog, WindowClause::endOffset, ereport, errcode(), errhint(), errmsg(), ERROR, EXPR_KIND_WINDOW_ORDER, EXPR_KIND_WINDOW_PARTITION, exprCollation(), fb(), findWindowClause(), FRAMEOPTION_DEFAULTS, FRAMEOPTION_END_OFFSET, FRAMEOPTION_GROUPS, FRAMEOPTION_RANGE, FRAMEOPTION_START_OFFSET, WindowClause::frameOptions, get_ordering_op_properties(), get_sortgroupclause_expr(), InvalidOid, lappend(), lfirst, linitial_node, list_length(), makeNode, NIL, WindowClause::orderClause, parser_errposition(), WindowClause::partitionClause, WindowClause::startOffset, transformFrameOffset(), transformGroupClause(), transformSortClause(), and WindowClause::winref.
Referenced by transformSelectStmt().