pub enum Source {
Table {
name: Slice,
alias: StrRef,
columns: Slice,
},
Subquery {
query: QueryRef,
alias: StrRef,
columns: Slice,
},
Function {
name: Slice,
args: Slice,
alias: StrRef,
columns: Slice,
pragma: bool,
},
Values {
rows: Slice,
alias: StrRef,
columns: Slice,
},
Join {
left: SourceRef,
right: SourceRef,
kind: JoinKind,
natural: bool,
on: ExprRef,
using: Slice,
},
}Expand description
One entry in a FROM clause, which is a tree because joins nest.
Variants§
Table
A named table, possibly qualified by schema and catalog.
Fields
Subquery
A parenthesised query in the FROM clause.
Fields
Function
A function call where a table goes, such as range(10).
Held with the name as a qualified run rather than a single string, because main.range(10)
is legal and a function in a schema that does not exist has to say so rather than being
looked up unqualified and found.
Fields
args: SliceThe arguments, as a run of Target where the alias is the parameter name and is
NONE for a positional one.
pragma: boolWhether the call was written as PRAGMA name rather than as a function call.
The two are the same query, because PRAGMA table_info('t') is rewritten to
SELECT * FROM pragma_table_info('t') here the way upstream rewrites it, and the
rewritten form is what the plan and the deparser see. What the flag is for is the two
messages a bad call produces, which upstream writes in the spelling the user used:
table_info() rather than pragma_table_info(), and a candidate line reading
PRAGMA "table_info"(VARCHAR). A user who wrote a pragma and is told about a function
they did not name has been handed the rewrite to debug rather than their own statement.
Values
A VALUES in the FROM clause.
Fields
Join
Two sources joined.