Skip to main content

PredicateSyntax

Struct PredicateSyntax 

Source
pub struct PredicateSyntax {
    pub like: bool,
    pub ilike: bool,
    pub similar_to: bool,
    pub overlaps_period_predicate: bool,
    pub unparenthesized_in_list: bool,
    pub pattern_match_quantifier: bool,
    pub between_symmetric: bool,
    pub is_normalized: bool,
    pub empty_in_list: bool,
    pub null_test_two_word_postfix: bool,
}
Expand description

Dialect-owned predicate-form syntax accepted by the parser.

The dialect-gated predicate forms beyond the always-available comparison / IS / IN baseline. They are predicates (non-chaining, comparison precedence), distinct from the ExpressionSyntax postfix/constructor forms, and — unlike those — not all PostgreSQL extensions: some are SQL Core surface on in every shipped dialect (LIKE, SQL-92 / SQL:2016 Core E021-08), while the rest are gated per dialect. Each is a pure grammar gate: when off, the keyword is left unconsumed and the trailing operand surfaces as a clean parse error — the same reject mechanism the other syntax gates use.

Fields§

§like: bool

Accept <expr> [NOT] LIKE <pattern> [ESCAPE <c>] (SQL-92 core E021-08). On in every dialect — this is the standard pattern-match predicate.

§ilike: bool

Accept <expr> [NOT] ILIKE <pattern> [ESCAPE <c>] case-insensitive matching (PostgreSQL).

§similar_to: bool

Accept <expr> [NOT] SIMILAR TO <pattern> [ESCAPE <c>] regex matching (SQL:1999 F841; PostgreSQL).

§overlaps_period_predicate: bool

Accept the SQL-standard (s1, e1) OVERLAPS (s2, e2) period predicate (SQL:2016 F251) — the row OVERLAPS row form yielding a boolean, both operands exactly-two-element rows (a bare parenthesized pair or ROW(...)). A pure grammar gate: when off, the OVERLAPS keyword is left unconsumed and surfaces as a clean parse error. The parser enforces the two-element-row operand shape on both sides (a scalar, a single-element grouping (a), or a three-element row is rejected, matching PostgreSQL’s grammar-level wrong-arity error), so a value stored here only opens the predicate — validity of the operands is still checked. PostgreSQL-only among the shipped presets (DuckDB, MySQL, and SQLite all reject the form, engine-probed); the Lenient union carries it too.

§unparenthesized_in_list: bool

Accept DuckDB’s unparenthesized <expr> [NOT] IN <value> list-membership operator (Expr::InExpr) — z IN y, distinct from the standard parenthesized IN (list) / IN (subquery). DuckDB-only: the right operand is a restricted c_expr that may not begin with a constant or unary sign (IN 4 / IN -5 are DuckDB parser errors), so the parser gates on the leading token. Off in every non-DuckDB preset (PostgreSQL and the standard require the parentheses).

§pattern_match_quantifier: bool

Accept a pattern-match predicate quantified over an array operand: <expr> [NOT] LIKE|ILIKE {ANY | ALL | SOME} (<array>) (Expr::QuantifiedLike) — PostgreSQL’s ScalarArrayOpExpr over the ~~/~~* operator. SIMILAR TO has no quantified form (PostgreSQL rejects it, engine-probed), so only LIKE/ILIKE open it. A pure grammar gate: when off, the ANY/ALL/SOME head after a pattern operator is left unconsumed and surfaces as the usual reject at the reserved quantifier keyword. PostgreSQL-only among the shipped presets; the Lenient union carries it too.

§between_symmetric: bool

Accept the SQL-standard SYMMETRIC/ASYMMETRIC modifier on the range predicate: <expr> [NOT] BETWEEN {SYMMETRIC | ASYMMETRIC} <low> AND <high> (SQL:2016 T461). SYMMETRIC is load-bearing — it permits low > high by testing against the ordered pair — and is kept on Expr::Between’s symmetric flag; the default ASYMMETRIC is a noise word dropped on parse. A pure grammar gate: when off, the modifier keyword after BETWEEN is left unconsumed and surfaces as a clean parse error. SYMMETRIC is an optional standard feature (T461), so it stays off in the strict ANSI baseline (and thus in MySQL/SQLite/ClickHouse/Snowflake, which reuse PredicateSyntax::ANSI and reject the modifier); on for PostgreSQL (engine-probed on pg_query) and the Lenient union.

§is_normalized: bool

Accept the SQL-standard Unicode-normalization test <expr> IS [NOT] [NFC|NFD|NFKC|NFKD] NORMALIZED (SQL:2016 T061), parsed to the postfix Expr::IsNormalized predicate. A pure grammar gate: when off, the NORMALIZED continuation after IS [NOT] is left unconsumed and the null/truth reading rejects it. An optional standard feature, so off in the strict ANSI baseline (and thus in MySQL/SQLite/ClickHouse/Snowflake, which reuse PredicateSyntax::ANSI and reject it); on for PostgreSQL (engine-probed on pg_query) and the Lenient union.

§empty_in_list: bool

Accept an empty parenthesized IN list — <expr> [NOT] IN () — with no elements, parsed to an Expr::InList whose list is empty. SQLite evaluates x IN () to false and x NOT IN () to true (engine-measured via rusqlite 3.53.2, where both prepare-accept). A pure grammar gate: when off, the closing ) in list position is left unconsumed and the required-first-element reject stands — the standard IN predicate demands at least one element, so ANSI/PostgreSQL/MySQL/DuckDB syntax-reject the empty list. On for SQLite and the Lenient union, off elsewhere.

§null_test_two_word_postfix: bool

Accept the two-word postfix null test <expr> NOT NULL (a synonym for IS NOT NULL), folded onto Expr::IsNull with negated: true and a NullTestSpelling::PostfixNotNull tag so it round-trips. A NOT-led predicate spelling, parsed at comparison precedence alongside the other NOT-led predicates (NOT IN/NOT LIKE/NOT BETWEEN); when off, the NOT NULL run is left unconsumed and the NOT surfaces as the ordinary prefix operator (or a clean parse error), so the two-word form is rejected.

Distinct from the one-word OperatorSyntax::null_test_postfix gate because the surfaces diverge (engine-measured): SQLite and DuckDB accept both spellings, but PostgreSQL — despite accepting the one-word ISNULL/NOTNULL — rejects the two-word NOT NULL postfix. On for SQLite and the Lenient union; off elsewhere (including PostgreSQL; DuckDB’s acceptance is tracked separately).

Implementations§

Source§

impl PredicateSyntax

Source

pub const ANSI: Self

The ANSI predefined value.

Source§

impl PredicateSyntax

Source

pub const DUCKDB: Self

Available on crate feature duckdb only.

The DUCKDB preset for predicate syntax.

Source§

impl PredicateSyntax

Source

pub const LENIENT: Self

Available on crate feature lenient only.

The LENIENT preset for predicate syntax.

Source§

impl PredicateSyntax

Source

pub const POSTGRES: Self

Available on crate feature postgres only.

The POSTGRES preset for predicate syntax.

Source§

impl PredicateSyntax

Source

pub const SQLITE: Self

Available on crate feature sqlite only.

The SQLITE preset for predicate syntax.

Trait Implementations§

Source§

impl Clone for PredicateSyntax

Source§

fn clone(&self) -> PredicateSyntax

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for PredicateSyntax

Source§

impl Debug for PredicateSyntax

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for PredicateSyntax

Source§

impl PartialEq for PredicateSyntax

Source§

fn eq(&self, other: &PredicateSyntax) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PredicateSyntax

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.