pub enum SourceRows {
Table,
Subquery(Box<BoundSelect>),
Recursive(Box<RecursiveBody>),
RecursiveSelf {
cte: usize,
},
}Expand description
Where one FROM term’s rows come from.
A subquery, a view and a CTE are all the same thing to everything below the binder: a block of SQL whose rows are materialised into an ephemeral table and then scanned like any other. Keeping them one variant is what stops the planner and the compiler growing three nearly-identical paths.
Variants§
Table
A real table’s B-tree.
Subquery(Box<BoundSelect>)
A nested query, materialised before the loop that scans it.
Recursive(Box<RecursiveBody>)
A recursive CTE, filled by running its seed and then its step arms until the step arms stop producing rows that are new.
RecursiveSelf
A reference to the recursive CTE being filled, which stands for exactly the one row the fill loop is currently on.
It shares the enclosing CTE’s store, so it is not a source that produces rows of its own: it is a window onto the row the queue is at.