Struct sql::plan::scope::ScopeItem[][src]

pub struct ScopeItem {
    pub table_name: Option<PartialName>,
    pub column_name: ColumnName,
    pub exprs: HashSet<Expr<Aug>>,
    pub from_single_column_function: bool,
    pub allow_unqualified_references: bool,
    pub lateral_error_if_referenced: bool,
    pub is_exists_column_for_a_table_function_that_was_in_the_target_list: bool,
    _private: (),
}

Fields

table_name: Option<PartialName>

The name of the table that produced this scope item, if any.

column_name: ColumnName

The name of the column.

exprs: HashSet<Expr<Aug>>

The expressions from which this scope item is derived. Used by GROUP BY.

from_single_column_function: bool

Whether the column is the return value of a function that produces only a single column. This accounts for a strange PostgreSQL special case around whole-row expansion.

allow_unqualified_references: bool

Controls whether the column is only accessible via a table-qualified reference. When false, the scope item is also excluded from SELECT *.

This should be true for almost all scope items. It is set to false for join columns in USING constraints. For exmaple, in t1 FULL JOIN t2 USING a, t1.a and t2.a are still available by fully-qualified reference, but a bare a refers to a new column whose value is coalesce(t1.a, t2.a). This is a big special case because normally having three columns in scope named a would result in “ambiguous column reference” errors.

lateral_error_if_referenced: bool

Whether reference the item should produce an error about the item being on the wrong side of a lateral join.

Per PostgreSQL (and apparently SQL:2008), we can’t simply make these items unnameable. These items need to exist because they might shadow variables in outer scopes that would otherwise be valid to reference, but accessing them needs to produce an error.

is_exists_column_for_a_table_function_that_was_in_the_target_list: bool

For table functions in scalar positions, this flag is true for the ordinality column. If true, then this column represents an “exists” flag for the entire row of the table function. In that case, this column must be excluded from * expansion. If the corresponding datum is NULL, then * expansion should yield a single NULL instead of a record with various datums.

_private: ()

Implementations

Constructs a new scope item from an unqualified column name.

Constructs a new scope item from a name.

Constructs a new scope item with no name from an expression.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Upcasts this ProgressEventTimestamp to Any. Read more

Returns the name of the concrete type of this object. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more