pub struct CteCycle {
pub columns: Vec<Cow<'static, str>>,
pub set: Cow<'static, str>,
pub using: Cow<'static, str>,
pub to: Option<Expr>,
pub default_val: Option<Expr>,
}Expand description
CYCLE <cols> SET <col> [TO <value> DEFAULT <value>] USING <col>
Stops a recursive CTE from looping forever over cyclic data by marking the row that closes a cycle.
§The mark values must be constants
PostgreSQL’s grammar spells the optional group
TO AexprConst DEFAULT AexprConst — a literal constant, not an expression, so
a bound argument in either slot is rejected by the server with a syntax error at
the placeholder. libpg_query confirms it. The fields are Exprs because
everything else in this module is, and because a constant is written
expr::literal or expr::raw; a
dialect’s cycle mod is where the narrowing belongs.
Fields§
§columns: Vec<Cow<'static, str>>The columns that identify a row, quoted.
set: Cow<'static, str>The name of the cycle-mark column to add, quoted.
using: Cow<'static, str>The name of the path column to add, quoted.
to: Option<Expr>The constant the mark column takes on a cycle. The grammar pairs this with
default_val: both or neither.
default_val: Option<Expr>The constant the mark column takes otherwise.