|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <ctype.h>#include "access/htup_details.h"#include "access/relation.h"#include "access/table.h"#include "catalog/heap.h"#include "catalog/namespace.h"#include "funcapi.h"#include "nodes/makefuncs.h"#include "nodes/nodeFuncs.h"#include "parser/parse_enr.h"#include "parser/parse_relation.h"#include "parser/parse_type.h"#include "parser/parsetree.h"#include "storage/lmgr.h"#include "utils/builtins.h"#include "utils/lsyscache.h"#include "utils/syscache.h"#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
| struct | FuzzyAttrMatchState |
Macros | |
| #define | MAX_FUZZY_DISTANCE 3 |
| #define MAX_FUZZY_DISTANCE 3 |
Definition at line 72 of file parse_relation.c.
| void addNSItemToQuery | ( | ParseState * | pstate, |
| ParseNamespaceItem * | nsitem, | ||
| bool | addToJoinList, | ||
| bool | addToRelNameSpace, | ||
| bool | addToVarNameSpace | ||
| ) |
Definition at line 2706 of file parse_relation.c.
References fb(), lappend(), makeNode, ParseState::p_joinlist, and ParseState::p_namespace.
Referenced by addNSItemForReturning(), AddRelationNewConstraints(), AlterPolicy(), CreatePolicy(), CreateTriggerFiringOn(), DefineRelation(), DoCopy(), setTargetTable(), test_rls_hooks_permissive(), test_rls_hooks_restrictive(), transformAlterTableStmt(), transformIndexStmt(), transformInsertStmt(), transformMergeStmt(), transformOnConflictClause(), transformPartitionSpec(), TransformPubWhereClauses(), transformRuleStmt(), transformSetOperationStmt(), transformStatsStmt(), and transformValuesClause().
| ParseNamespaceItem * addRangeTableEntry | ( | ParseState * | pstate, |
| RangeVar * | relation, | ||
| Alias * | alias, | ||
| bool | inh, | ||
| bool | inFromCl | ||
| ) |
Definition at line 1483 of file parse_relation.c.
References AccessShareLock, ACL_SELECT, addRTEPermissionInfo(), Alias::aliasname, Assert, buildNSItemFromTupleDesc(), buildRelationAliases(), fb(), isLockedRefname(), lappend(), list_length(), makeAlias(), makeNode, NIL, NoLock, ParseState::p_rtable, ParseState::p_rteperminfos, parserOpenTable(), RelationData::rd_att, RelationData::rd_rel, RelationGetRelid, RangeVar::relname, RowShareLock, RTE_RELATION, and table_close().
Referenced by transformTableEntry().
| ParseNamespaceItem * addRangeTableEntryForCTE | ( | ParseState * | pstate, |
| CommonTableExpr * | cte, | ||
| Index | levelsup, | ||
| RangeVar * | rv, | ||
| bool | inFromCl | ||
| ) |
Definition at line 2328 of file parse_relation.c.
References RangeVar::alias, Alias::aliasname, Assert, buildNSItemFromLists(), CMD_SELECT, Query::commandType, copyObject, CommonTableExpr::ctename, CommonTableExpr::ctequery, ereport, errcode(), errmsg(), ERROR, fb(), i, InvalidOid, IsA, lappend(), lappend_int(), lappend_oid(), lfirst, list_copy(), list_length(), RangeVar::location, makeAlias(), makeNode, makeString(), NIL, ParseState::p_rtable, parser_errposition(), Query::returningList, and RTE_CTE.
Referenced by getNSItemForSpecialRelationTypes().
| ParseNamespaceItem * addRangeTableEntryForENR | ( | ParseState * | pstate, |
| RangeVar * | rv, | ||
| bool | inFromCl | ||
| ) |
Definition at line 2480 of file parse_relation.c.
References RangeVar::alias, Alias::aliasname, Assert, buildNSItemFromTupleDesc(), buildRelationAliases(), elog, ENR_NAMED_TUPLESTORE, ENRMetadataGetTupDesc(), ERROR, fb(), get_visible_ENR(), InvalidOid, lappend(), lappend_int(), lappend_oid(), list_length(), makeAlias(), makeNode, TupleDescData::natts, NIL, ParseState::p_rtable, RangeVar::relname, RTE_NAMEDTUPLESTORE, and TupleDescAttr().
Referenced by getNSItemForSpecialRelationTypes().
| ParseNamespaceItem * addRangeTableEntryForFunction | ( | ParseState * | pstate, |
| List * | funcnames, | ||
| List * | funcexprs, | ||
| List * | coldeflists, | ||
| RangeFunction * | rangefunc, | ||
| bool | lateral, | ||
| bool | inFromCl | ||
| ) |
Definition at line 1747 of file parse_relation.c.
References Alias::aliasname, Assert, buildNSItemFromTupleDesc(), buildRelationAliases(), CheckAttributeNamesTypes(), CHKATYPE_ANYRECORD, chooseScalarFunctionAlias(), ColumnDef::colname, CreateTemplateTupleDesc(), ereport, errcode(), errmsg(), ERROR, exprCollation(), exprLocation(), exprType(), exprTypmod(), fb(), format_type_be(), forthree, RangeTblFunction::funcexpr, funcname, get_expr_result_type(), GetColumnDefCollation(), i, InvalidOid, j, lappend(), lappend_int(), lappend_oid(), lfirst, linitial, list_length(), ColumnDef::location, makeAlias(), makeNode, makeString(), MaxHeapAttributeNumber, MaxTupleAttributeNumber, TupleDescData::natts, NIL, ParseState::p_rtable, palloc_array, parser_errposition(), pstrdup(), RTE_FUNCTION, TypeName::setof, TupleDescCopyEntry(), TupleDescInitEntry(), TupleDescInitEntryCollation(), TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, TYPEFUNC_RECORD, TYPEFUNC_SCALAR, ColumnDef::typeName, and typenameTypeIdAndMod().
Referenced by transformRangeFunction().
| ParseNamespaceItem * addRangeTableEntryForGroup | ( | ParseState * | pstate, |
| List * | groupClauses | ||
| ) |
Definition at line 2579 of file parse_relation.c.
References Assert, buildNSItemFromLists(), copyObject, TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), fb(), lappend(), lappend_int(), lappend_oid(), lfirst, list_length(), makeAlias(), makeNode, makeString(), NIL, ParseState::p_rtable, pstrdup(), and RTE_GROUP.
Referenced by parseCheckAggregates().
| ParseNamespaceItem * addRangeTableEntryForJoin | ( | ParseState * | pstate, |
| List * | colnames, | ||
| ParseNamespaceColumn * | nscolumns, | ||
| JoinType | jointype, | ||
| int | nummergedcols, | ||
| List * | aliasvars, | ||
| List * | leftcols, | ||
| List * | rightcols, | ||
| Alias * | join_using_alias, | ||
| Alias * | alias, | ||
| bool | inFromCl | ||
| ) |
Definition at line 2229 of file parse_relation.c.
References Assert, copyObject, ereport, errcode(), errmsg(), ERROR, fb(), InvalidOid, lappend(), list_concat(), list_copy_tail(), list_length(), makeAlias(), makeNode, MaxAttrNumber, NIL, ParseState::p_rtable, palloc_object, RTE_JOIN, and VAR_RETURNING_DEFAULT.
Referenced by transformFromClauseItem(), and transformSetOperationStmt().
| ParseNamespaceItem * addRangeTableEntryForRelation | ( | ParseState * | pstate, |
| Relation | rel, | ||
| int | lockmode, | ||
| Alias * | alias, | ||
| bool | inh, | ||
| bool | inFromCl | ||
| ) |
Definition at line 1580 of file parse_relation.c.
References AccessShareLock, ACL_SELECT, addRTEPermissionInfo(), Alias::aliasname, Assert, buildNSItemFromTupleDesc(), buildRelationAliases(), CheckRelationLockedByMe(), fb(), lappend(), list_length(), makeAlias(), makeNode, NIL, ParseState::p_rtable, ParseState::p_rteperminfos, RelationData::rd_att, RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, RowExclusiveLock, RowShareLock, and RTE_RELATION.
Referenced by AddRelationNewConstraints(), AlterPolicy(), copy_table(), CreatePolicy(), CreateTriggerFiringOn(), DefineRelation(), DoCopy(), rewriteTargetView(), setTargetTable(), test_rls_hooks_permissive(), test_rls_hooks_restrictive(), transformAlterTableStmt(), transformIndexStmt(), transformOnConflictClause(), transformPartitionSpec(), TransformPubWhereClauses(), transformRuleStmt(), and transformStatsStmt().
| ParseNamespaceItem * addRangeTableEntryForSubquery | ( | ParseState * | pstate, |
| Query * | subquery, | ||
| Alias * | alias, | ||
| bool | lateral, | ||
| bool | inFromCl | ||
| ) |
Definition at line 1651 of file parse_relation.c.
References Assert, buildNSItemFromLists(), copyObject, ereport, errcode(), errmsg(), ERROR, TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), fb(), lappend(), lappend_int(), lappend_oid(), lfirst, list_length(), makeAlias(), makeNode, makeString(), NIL, ParseState::p_rtable, pstrdup(), TargetEntry::resno, RTE_SUBQUERY, and Query::targetList.
Referenced by convert_ANY_sublink_to_join(), transformInsertStmt(), transformRangeSubselect(), and transformSetOperationTree().
| ParseNamespaceItem * addRangeTableEntryForTableFunc | ( | ParseState * | pstate, |
| TableFunc * | tf, | ||
| Alias * | alias, | ||
| bool | lateral, | ||
| bool | inFromCl | ||
| ) |
Definition at line 2062 of file parse_relation.c.
References Alias::aliasname, Assert, buildNSItemFromLists(), copyObject, ereport, errcode(), errmsg(), ERROR, exprLocation(), fb(), TableFunc::functype, InvalidOid, lappend(), list_concat(), list_copy_tail(), list_length(), makeAlias(), makeNode, MaxTupleAttributeNumber, NIL, ParseState::p_rtable, parser_errposition(), pstrdup(), RTE_TABLEFUNC, and TFT_XMLTABLE.
Referenced by transformJsonTable(), and transformRangeTableFunc().
| ParseNamespaceItem * addRangeTableEntryForValues | ( | ParseState * | pstate, |
| List * | exprs, | ||
| List * | coltypes, | ||
| List * | coltypmods, | ||
| List * | colcollations, | ||
| Alias * | alias, | ||
| bool | lateral, | ||
| bool | inFromCl | ||
| ) |
Definition at line 2147 of file parse_relation.c.
References Alias::aliasname, Assert, buildNSItemFromLists(), copyObject, ereport, errcode(), errmsg(), ERROR, fb(), InvalidOid, lappend(), linitial, list_length(), makeAlias(), makeNode, makeString(), NIL, ParseState::p_rtable, pstrdup(), RTE_VALUES, and snprintf.
Referenced by transformInsertStmt(), and transformValuesClause().
| RTEPermissionInfo * addRTEPermissionInfo | ( | List ** | rteperminfos, |
| RangeTblEntry * | rte | ||
| ) |
Definition at line 3929 of file parse_relation.c.
References Assert, fb(), lappend(), list_length(), makeNode, and OidIsValid.
Referenced by add_rte_to_flat_rtable(), addRangeTableEntry(), addRangeTableEntryForRelation(), create_edata_for_relation(), create_estate_for_relation(), plan_cluster_use_sort(), plan_create_index_workers(), and rewriteTargetView().
Definition at line 3585 of file parse_relation.c.
References attname, fb(), i, InvalidAttrNumber, namestrcmp(), RelationGetNumberOfAttributes, specialAttNum(), and TupleDescAttr().
Referenced by checkInsertTargets(), CreateTriggerFiringOn(), do_analyze_rel(), and transformUpdateTargetList().
Definition at line 3635 of file parse_relation.c.
References elog, ERROR, fb(), FormData_pg_attribute, SystemAttributeDefinition(), and TupleDescAttr().
Referenced by transformFkeyGetPrimaryKey().
Definition at line 3677 of file parse_relation.c.
References elog, ERROR, fb(), InvalidOid, and TupleDescAttr().
Referenced by transformFkeyGetPrimaryKey().
Definition at line 3657 of file parse_relation.c.
References elog, ERROR, fb(), FormData_pg_attribute, SystemAttributeDefinition(), and TupleDescAttr().
Referenced by transformAssignedExpr(), and transformFkeyGetPrimaryKey().
|
static |
Definition at line 1366 of file parse_relation.c.
References Assert, fb(), forthree, lfirst_int, lfirst_oid, list_length(), palloc0(), palloc_object, and VAR_RETURNING_DEFAULT.
Referenced by addRangeTableEntryForCTE(), addRangeTableEntryForGroup(), addRangeTableEntryForSubquery(), addRangeTableEntryForTableFunc(), and addRangeTableEntryForValues().
|
static |
Definition at line 1305 of file parse_relation.c.
References Assert, fb(), list_length(), TupleDescData::natts, palloc0(), palloc_object, TupleDescAttr(), and VAR_RETURNING_DEFAULT.
Referenced by addRangeTableEntry(), addRangeTableEntryForENR(), addRangeTableEntryForFunction(), and addRangeTableEntryForRelation().
Definition at line 1188 of file parse_relation.c.
References Assert, Alias::colnames, ereport, errcode(), errmsg(), ERROR, fb(), lappend(), lfirst_node, list_head(), list_length(), lnext(), makeString(), NameStr, TupleDescData::natts, NIL, pstrdup(), and TupleDescAttr().
Referenced by addRangeTableEntry(), addRangeTableEntryForENR(), addRangeTableEntryForFunction(), and addRangeTableEntryForRelation().
|
static |
Definition at line 487 of file parse_relation.c.
References ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, fb(), ParseNamespaceItem::p_rte, ParseState::p_target_nsitem, and parser_errposition().
Referenced by colNameToVar(), scanNameSpaceForRefname(), and scanNameSpaceForRelid().
| void checkNameSpaceConflicts | ( | ParseState * | pstate, |
| List * | namespace1, | ||
| List * | namespace2 | ||
| ) |
Definition at line 438 of file parse_relation.c.
References ereport, errcode(), errmsg(), ERROR, fb(), lfirst, and RTE_RELATION.
Referenced by transformFromClause(), and transformFromClauseItem().
|
static |
Definition at line 1265 of file parse_relation.c.
References Alias::aliasname, fb(), funcname, get_func_result_name(), and IsA.
Referenced by addRangeTableEntryForFunction().
Definition at line 894 of file parse_relation.c.
References check_lateral_ref_ok(), ereport, errcode(), errmsg(), ERROR, fb(), lfirst, ParseState::p_lateral_active, ParseState::p_namespace, ParseState::parentParseState, parser_errposition(), and scanNSItemForColumn().
Referenced by findTargetlistEntrySQL92(), and transformColumnRef().
| void errorMissingColumn | ( | ParseState * | pstate, |
| const char * | relname, | ||
| const char * | colname, | ||
| int | location | ||
| ) |
Definition at line 3767 of file parse_relation.c.
References ereport, errcode(), errdetail(), errhint(), errmsg(), ERROR, fb(), list_nth(), parser_errposition(), relname, rte_visible_if_lateral(), rte_visible_if_qualified(), searchRangeTableForCol(), and strVal.
Referenced by transformColumnRef().
| void errorMissingRTE | ( | ParseState * | pstate, |
| RangeVar * | relation | ||
| ) |
Definition at line 3696 of file parse_relation.c.
References ereport, errcode(), ERRCODE_UNDEFINED_TABLE, errdetail(), errhint(), errmsg(), ERROR, fb(), RangeVar::location, parser_errposition(), refnameNamespaceItem(), RangeVar::relname, rte_visible_if_lateral(), and searchRangeTableForRel().
Referenced by ExpandColumnRefStar(), and transformColumnRef().
| List * expandNSItemAttrs | ( | ParseState * | pstate, |
| ParseNamespaceItem * | nsitem, | ||
| int | sublevels_up, | ||
| bool | require_col_privs, | ||
| int | location | ||
| ) |
Definition at line 3288 of file parse_relation.c.
References ACL_SELECT, Assert, expandNSItemVars(), fb(), forboth, label, lappend(), lfirst, makeTargetEntry(), markVarForSelectPriv(), name, NIL, ParseState::p_next_resno, RTE_RELATION, and strVal.
Referenced by ExpandAllTables(), ExpandSingleTable(), and transformValuesClause().
| List * expandNSItemVars | ( | ParseState * | pstate, |
| ParseNamespaceItem * | nsitem, | ||
| int | sublevels_up, | ||
| int | location, | ||
| List ** | colnames | ||
| ) |
Definition at line 3223 of file parse_relation.c.
References Assert, fb(), lappend(), lfirst, Var::location, makeVar(), markNullableIfNeeded(), NIL, strVal, and Var::varreturningtype.
Referenced by coerce_record_to_complex(), expandNSItemAttrs(), ExpandSingleTable(), and transformInsertStmt().
|
static |
Definition at line 3114 of file parse_relation.c.
References AccessShareLock, expandTupleDesc(), fb(), TupleDescData::natts, RelationData::rd_att, relation_close(), and relation_open().
Referenced by expandRTE().
| void expandRTE | ( | RangeTblEntry * | rte, |
| int | rtindex, | ||
| int | sublevels_up, | ||
| VarReturningType | returning_type, | ||
| int | location, | ||
| bool | include_dropped, | ||
| List ** | colnames, | ||
| List ** | colvars | ||
| ) |
Definition at line 2747 of file parse_relation.c.
References Assert, attnum, copyObject, elog, ERROR, expandRelation(), expandTupleDesc(), TargetEntry::expr, exprCollation(), exprType(), exprTypmod(), fb(), forboth, forthree, RangeTblFunction::funcexpr, get_expr_result_type(), InvalidOid, IsA, label, lappend(), lfirst, lfirst_int, lfirst_oid, list_concat(), list_copy_tail(), list_head(), list_length(), list_nth(), list_truncate(), llast, lnext(), makeNullConst(), makeString(), makeVar(), NIL, OidIsValid, pstrdup(), TargetEntry::resno, RTE_CTE, RTE_FUNCTION, RTE_GROUP, RTE_JOIN, RTE_NAMEDTUPLESTORE, RTE_RELATION, RTE_RESULT, RTE_SUBQUERY, RTE_TABLEFUNC, RTE_VALUES, strVal, TYPEFUNC_COMPOSITE, TYPEFUNC_COMPOSITE_DOMAIN, TYPEFUNC_RECORD, and TYPEFUNC_SCALAR.
Referenced by build_physical_tlist(), expandRecordVariable(), ReplaceVarFromTargetList(), set_relation_column_names(), and transformWholeRowRef().
|
static |
Definition at line 3140 of file parse_relation.c.
References Assert, fb(), InvalidOid, label, lappend(), lfirst, list_length(), list_nth_cell(), lnext(), makeNullConst(), makeString(), makeVar(), NameStr, pstrdup(), strVal, and TupleDescAttr().
Referenced by expandRelation(), and expandRTE().
|
static |
Definition at line 3860 of file parse_relation.c.
References fb(), lfirst, ParseState::p_namespace, and ParseState::parentParseState.
Referenced by rte_visible_if_lateral(), and rte_visible_if_qualified().
| RowMarkClause * get_parse_rowmark | ( | Query * | qry, |
| Index | rtindex | ||
| ) |
Definition at line 3561 of file parse_relation.c.
References fb(), lfirst, Query::rowMarks, and RowMarkClause::rti.
Referenced by AcquireRewriteLocks(), applyLockingClause(), and ApplyRetrieveRule().
| bool get_rte_attribute_is_dropped | ( | RangeTblEntry * | rte, |
| AttrNumber | attnum | ||
| ) |
Definition at line 3392 of file parse_relation.c.
References Assert, attnum, elog, ereport, errcode(), errmsg(), ERROR, fb(), RangeTblFunction::funcexpr, get_expr_result_tupdesc(), GETSTRUCT(), HeapTupleIsValid, Int16GetDatum(), lfirst, list_length(), list_nth(), list_nth_oid(), NIL, ObjectIdGetDatum(), OidIsValid, ReleaseSysCache(), RTE_CTE, RTE_FUNCTION, RTE_GROUP, RTE_JOIN, RTE_NAMEDTUPLESTORE, RTE_RELATION, RTE_RESULT, RTE_SUBQUERY, RTE_TABLEFUNC, RTE_VALUES, SearchSysCache2(), and TupleDescCompactAttr().
Referenced by AcquireRewriteLocks().
| char * get_rte_attribute_name | ( | RangeTblEntry * | rte, |
| AttrNumber | attnum | ||
| ) |
Definition at line 3354 of file parse_relation.c.
References attnum, elog, ERROR, fb(), get_attname(), InvalidAttrNumber, list_length(), list_nth(), RTE_RELATION, and strVal.
Referenced by get_name_for_var_field(), get_variable(), print_expr(), and substitute_grouped_columns_mutator().
| TargetEntry * get_tle_by_resno | ( | List * | tlist, |
| AttrNumber | resno | ||
| ) |
Definition at line 3541 of file parse_relation.c.
Referenced by adjust_view_column_set(), count_rowexpr_columns(), currtid_for_view(), examine_simple_variable(), expandRecordVariable(), get_name_for_var_field(), get_variable(), make_sort_from_groupcols(), markTargetListOrigin(), prepare_sort_from_pathkeys(), ReplaceVarFromTargetList(), resolve_special_varno(), rewriteTargetView(), show_grouping_set_keys(), show_sort_group_keys(), and show_window_keys().
| CommonTableExpr * GetCTEForRTE | ( | ParseState * | pstate, |
| RangeTblEntry * | rte, | ||
| int | rtelevelsup | ||
| ) |
Definition at line 561 of file parse_relation.c.
References Assert, CommonTableExpr::ctename, elog, ERROR, fb(), lfirst, ParseState::p_ctenamespace, ParseState::parentParseState, and RTE_CTE.
Referenced by expandRecordVariable(), and markTargetListOrigin().
| ParseNamespaceItem * GetNSItemByRangeTablePosn | ( | ParseState * | pstate, |
| int | varno, | ||
| int | sublevels_up | ||
| ) |
Definition at line 514 of file parse_relation.c.
References Assert, elog, ERROR, fb(), lfirst, ParseState::p_namespace, and ParseState::parentParseState.
Referenced by coerce_record_to_complex(), ExpandRowReference(), ParseComplexProjection(), and transformMergeStmt().
| RangeTblEntry * GetRTEByRangeTablePosn | ( | ParseState * | pstate, |
| int | varno, | ||
| int | sublevels_up | ||
| ) |
Definition at line 541 of file parse_relation.c.
References Assert, fb(), list_length(), ParseState::p_rtable, ParseState::parentParseState, and rt_fetch.
Referenced by count_rowexpr_columns(), expandRecordVariable(), markTargetListOrigin(), and unknown_attribute().
| RTEPermissionInfo * getRTEPermissionInfo | ( | List * | rteperminfos, |
| RangeTblEntry * | rte | ||
| ) |
Definition at line 3958 of file parse_relation.c.
References elog, ERROR, fb(), list_length(), and list_nth_node.
Referenced by add_rte_to_flat_rtable(), all_rows_selectable(), build_simple_rel(), ExecCheckPermissions(), expand_inherited_rtentry(), get_rel_all_updated_cols(), get_row_security_policies(), GetResultRTEPermissionInfo(), markQueryForLocking(), markRTEForSelectPriv(), rewriteTargetView(), subquery_planner(), and transformLockingClause().
|
static |
Definition at line 317 of file parse_relation.c.
References CommonTableExpr::ctename, fb(), lfirst, ParseState::p_future_ctes, and ParseState::parentParseState.
Referenced by parserOpenTable().
| bool isLockedRefname | ( | ParseState * | pstate, |
| const char * | refname | ||
| ) |
Definition at line 2662 of file parse_relation.c.
References fb(), lfirst, NIL, ParseState::p_locked_from_parent, and ParseState::p_locking_clause.
Referenced by addRangeTableEntry(), and transformRangeSubselect().
| void markNullableIfNeeded | ( | ParseState * | pstate, |
| Var * | var | ||
| ) |
Definition at line 1046 of file parse_relation.c.
References bms_union(), fb(), list_length(), list_nth(), ParseState::p_nullingrels, ParseState::parentParseState, Var::varlevelsup, and Var::varno.
Referenced by buildVarFromNSColumn(), expandNSItemVars(), scanNSItemForColumn(), and transformWholeRowRef().
|
static |
Definition at line 1077 of file parse_relation.c.
References ACL_SELECT, bms_add_member(), elog, ERROR, fb(), FirstLowInvalidHeapAttributeNumber, getRTEPermissionInfo(), InvalidAttrNumber, IsA, j, list_length(), list_nth_node, markRTEForSelectPriv(), nodeTag, ParseState::p_joinexprs, ParseState::p_rtable, ParseState::p_rteperminfos, rt_fetch, RTE_JOIN, and RTE_RELATION.
Referenced by markRTEForSelectPriv(), and markVarForSelectPriv().
| void markVarForSelectPriv | ( | ParseState * | pstate, |
| Var * | var | ||
| ) |
Definition at line 1161 of file parse_relation.c.
References Assert, fb(), IsA, markRTEForSelectPriv(), ParseState::parentParseState, Var::varattno, Var::varlevelsup, and Var::varno.
Referenced by expandNSItemAttrs(), ExpandSingleTable(), scanNSItemForColumn(), transformJoinUsingClause(), and transformWholeRowRef().
| Relation parserOpenTable | ( | ParseState * | pstate, |
| const RangeVar * | relation, | ||
| int | lockmode | ||
| ) |
Definition at line 1431 of file parse_relation.c.
References cancel_parser_errposition_callback(), ereport, errcode(), ERRCODE_UNDEFINED_TABLE, errdetail(), errhint(), errmsg(), ERROR, fb(), isFutureCTE(), RangeVar::location, RangeVar::relname, RangeVar::schemaname, setup_parser_errposition_callback(), and table_openrv_extended().
Referenced by addRangeTableEntry(), and setTargetTable().
| ParseNamespaceItem * refnameNamespaceItem | ( | ParseState * | pstate, |
| const char * | schemaname, | ||
| const char * | refname, | ||
| int | location, | ||
| int * | sublevels_up | ||
| ) |
Definition at line 130 of file parse_relation.c.
References fb(), get_relname_relid(), InvalidOid, LookupNamespaceNoError(), OidIsValid, ParseState::parentParseState, scanNameSpaceForRefname(), and scanNameSpaceForRelid().
Referenced by errorMissingRTE(), ExpandColumnRefStar(), transformColumnRef(), and transformReturningClause().
|
static |
Definition at line 3888 of file parse_relation.c.
References fb(), findNSItemForRTE(), and ParseState::p_lateral_active.
Referenced by errorMissingColumn(), and errorMissingRTE().
|
static |
Definition at line 3908 of file parse_relation.c.
References fb(), and findNSItemForRTE().
Referenced by errorMissingColumn().
| CommonTableExpr * scanNameSpaceForCTE | ( | ParseState * | pstate, |
| const char * | refname, | ||
| Index * | ctelevelsup | ||
| ) |
Definition at line 286 of file parse_relation.c.
References CommonTableExpr::ctename, fb(), lfirst, ParseState::p_ctenamespace, and ParseState::parentParseState.
Referenced by getNSItemForSpecialRelationTypes(), and searchRangeTableForRel().
| bool scanNameSpaceForENR | ( | ParseState * | pstate, |
| const char * | refname | ||
| ) |
Definition at line 339 of file parse_relation.c.
References name_matches_visible_ENR().
Referenced by getNSItemForSpecialRelationTypes(), searchRangeTableForRel(), and setTargetTable().
|
static |
Definition at line 201 of file parse_relation.c.
References check_lateral_ref_ok(), ereport, errcode(), errmsg(), ERROR, fb(), lfirst, ParseState::p_lateral_active, ParseState::p_namespace, and parser_errposition().
Referenced by refnameNamespaceItem().
|
static |
Definition at line 241 of file parse_relation.c.
References check_lateral_ref_ok(), ereport, errcode(), errmsg(), ERROR, fb(), lfirst, ParseState::p_lateral_active, ParseState::p_namespace, parser_errposition(), RTE_RELATION, and VAR_RETURNING_DEFAULT.
Referenced by refnameNamespaceItem().
| Node * scanNSItemForColumn | ( | ParseState * | pstate, |
| ParseNamespaceItem * | nsitem, | ||
| int | sublevels_up, | ||
| const char * | colname, | ||
| int | location | ||
| ) |
Definition at line 684 of file parse_relation.c.
References attnum, ereport, errcode(), errmsg(), ERROR, EXPR_KIND_CHECK_CONSTRAINT, EXPR_KIND_GENERATED_COLUMN, EXPR_KIND_MERGE_WHEN, fb(), FormData_pg_attribute, InvalidAttrNumber, Var::location, makeVar(), markNullableIfNeeded(), markVarForSelectPriv(), ParseState::p_expr_kind, parser_errposition(), scanRTEForColumn(), SystemAttributeDefinition(), TableOidAttributeNumber, and Var::varreturningtype.
Referenced by colNameToVar(), ParseComplexProjection(), and transformColumnRef().
|
static |
Definition at line 811 of file parse_relation.c.
References attnum, ereport, errcode(), errmsg(), ERROR, fb(), Int16GetDatum(), InvalidAttrNumber, lfirst, ObjectIdGetDatum(), parser_errposition(), RTE_RELATION, SearchSysCacheExists2, specialAttNum(), strVal, and updateFuzzyAttrMatchState().
Referenced by scanNSItemForColumn(), and searchRangeTableForCol().
|
static |
Definition at line 963 of file parse_relation.c.
References attnum, fb(), InvalidAttrNumber, lfirst, MAX_FUZZY_DISTANCE, ParseState::p_rtable, palloc_object, ParseState::parentParseState, RTE_JOIN, scanRTEForColumn(), and varstr_levenshtein_less_equal().
Referenced by errorMissingColumn().
|
static |
Definition at line 360 of file parse_relation.c.
References fb(), InvalidOid, lfirst, NoLock, OidIsValid, ParseState::p_rtable, ParseState::parentParseState, RangeVarGetRelid, RangeVar::relname, RTE_CTE, RTE_NAMEDTUPLESTORE, RTE_RELATION, scanNameSpaceForCTE(), scanNameSpaceForENR(), and RangeVar::schemaname.
Referenced by errorMissingRTE().
Definition at line 3616 of file parse_relation.c.
References attname, fb(), FormData_pg_attribute, InvalidAttrNumber, and SystemAttributeByName().
Referenced by attnameAttNum(), and scanRTEForColumn().
|
static |
Definition at line 591 of file parse_relation.c.
References attnum, fb(), and varstr_levenshtein_less_equal().
Referenced by scanRTEForColumn().