[][src]Enum postgres_parser::sys::RTEKind

#[repr(u32)]pub enum RTEKind {
    RTE_RELATION,
    RTE_SUBQUERY,
    RTE_JOIN,
    RTE_FUNCTION,
    RTE_TABLEFUNC,
    RTE_VALUES,
    RTE_CTE,
    RTE_NAMEDTUPLESTORE,
    RTE_RESULT,
}

RangeTblEntry A range table is a List of RangeTblEntry nodes.

A range table entry may represent a plain relation, a subselect in FROM, or the result of a JOIN clause. (Only explicit JOIN syntax produces an RTE, not the implicit join resulting from multiple FROM items. This is because we only need the RTE to deal with SQL features like outer joins and joinoutputcolumn aliasing.) Other special RTE types also exist, as indicated by RTEKind.

Note that we consider RTE_RELATION to cover anything that has a pg_class entry. relkind distinguishes the subcases.

alias is an Alias node representing the AS aliasclause attached to the FROM expression, or NULL if no clause.

eref is the table reference name and column reference names (either real or aliases). Note that system columns (OID etc) are not included in the column list. eref>aliasname is required to be present, and should generally be used to identify the RTE for error messages etc.

In RELATION RTEs, the colnames in both alias and eref are indexed by physical attribute number; this means there must be colname entries for dropped columns. When building an RTE we insert empty strings ("") for dropped columns. Note however that a stored rule may have nonempty colnames for columns dropped since the rule was created (and for that matter the colnames might be out of date due to column renamings). The same comments apply to FUNCTION RTEs when a function's return type is a named composite type.

In JOIN RTEs, the colnames in both alias and eref are onetoone with joinaliasvars entries. A JOIN RTE will omit columns of its inputs when those columns are known to be dropped at parse time. Again, however, a stored rule might contain entries for columns dropped since the rule was created. (This is only possible for columns not actually referenced in the rule.) When loading a stored rule, we replace the joinaliasvars items for any such columns with null pointers. (We can't simply delete them from the joinaliasvars list, because that would affect the attnums of Vars referencing the rest of the list.)

inh is true for relation references that should be expanded to include inheritance children, if the rel has any. This must be false for RTEs other than RTE_RELATION entries.

inFromCl marks those range variables that are listed in the FROM clause. It's false for RTEs that are added to a query behind the scenes, such as the NEW and OLD variables for a rule, or the subqueries of a UNION. This flag is not used anymore during parsing, since the parser now uses a separate "namespace" data structure to control visibility, but it is needed by ruleutils.c to determine whether RTEs should be shown in decompiled queries.

requiredPerms and checkAsUser specify runtime access permissions checks to be performed at query startup. The user must have all of the permissions that are OR'd together in requiredPerms (zero indicates no permissions checking). If checkAsUser is not zero, then do the permissions checks using the access rights of that user, not the current effective user ID. (This allows rules to act as setuid gateways.) Permissions checks only apply to RELATION RTEs.

For SELECT/INSERT/UPDATE permissions, if the user doesn't have tablewide permissions then it is sufficient to have the permissions on all columns identified in selectedCols (for SELECT) and/or insertedCols and/or updatedCols (INSERT with ON CONFLICT DO UPDATE may have all 3). selectedCols, insertedCols and updatedCols are bitmapsets, which cannot have negative integer members, so we subtract FirstLowInvalidHeapAttributeNumber from column numbers before storing them in these fields. A wholerow Var reference is represented by setting the bit for InvalidAttrNumber.

updatedCols is also used in some other places, for example, to determine which triggers to fire and in FDWs to know which changed columns they need to ship off. Generated columns that are caused to be updated by an update to a base column are collected in extraUpdatedCols. This is not considered for permission checking, but it is useful in those places that want to know the full set of columns being updated as opposed to only the ones the user explicitly mentioned in the query. (There is currently no need for an extraInsertedCols, but it could exist.)

securityQuals is a list of security barrier quals (boolean expressions), to be tested in the listed order before returning a row from the relation. It is always NIL in parser output. Entries are added by the rewriter to implement securitybarrier views and/or rowlevel security. Note that the planner turns each boolean expression into an implicitly AND'ed sublist, as is its usual habit with qualification expressions.

Variants

RTE_RELATION
RTE_SUBQUERY

ordinary relation reference

RTE_JOIN

subquery in FROM

RTE_FUNCTION

join

RTE_TABLEFUNC

function in FROM

RTE_VALUES

TableFunc(.., column list)

RTE_CTE

VALUES (), (), ...

RTE_NAMEDTUPLESTORE

common table expr (WITH list element)

RTE_RESULT

tuplestore, e.g. for AFTER triggers

Trait Implementations

impl Clone for RTEKind[src]

impl Copy for RTEKind[src]

impl Debug for RTEKind[src]

impl<'de> Deserialize<'de> for RTEKind[src]

impl Eq for RTEKind[src]

impl Hash for RTEKind[src]

impl PartialEq<RTEKind> for RTEKind[src]

impl Serialize for RTEKind[src]

impl StructuralEq for RTEKind[src]

impl StructuralPartialEq for RTEKind[src]

Auto Trait Implementations

impl RefUnwindSafe for RTEKind

impl Send for RTEKind

impl Sync for RTEKind

impl Unpin for RTEKind

impl UnwindSafe for RTEKind

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.