Enum sqlparser::ast::Expr [−][src]
An SQL expression of any type.
The parser does not distinguish between expressions of different types
(e.g. boolean vs string), so the caller must handle expressions of
inappropriate type, like WHERE 1 or SELECT 1=1, as necessary.
Variants
Identifier(Ident)Identifier e.g. table name or column name
Unqualified wildcard (*). SQL allows this in limited contexts, such as:
- right after
SELECT(which is represented as a SelectItem::Wildcard instead) - or as part of an aggregate function, e.g.
COUNT(*),
...but we currently also accept it in contexts where it doesn't make
sense, such as * + *
Qualified wildcard, e.g. alias.* or schema.table.*.
(Same caveats apply to QualifiedWildcard as to Wildcard.)
Multi-part identifier, e.g. table_alias.column or schema.table.col
IS NULL expression
IS NOT NULL expression
[ NOT ] IN (val1, val2, ...)
[ NOT ] IN (SELECT ...)
<expr> [ NOT ] BETWEEN <low> AND <high>
Binary operation e.g. 1 + 1 or foo > bar
Fields of BinaryOp
Unary operation e.g. NOT foo
Fields of UnaryOp
op: UnaryOperatorexpr: Box<Expr>CAST an expression to a different data type e.g. CAST(foo AS VARCHAR(123))
EXTRACT(DateTimeField FROM
Fields of Extract
field: DateTimeFieldexpr: Box<Expr>SUBSTRING(
expr COLLATE collation
Fields of Collate
expr: Box<Expr>collation: ObjectNameNested expression e.g. (foo > bar) or (1)
Value(Value)A literal value, such as string, number, date or NULL
A constant of form <data_type> 'value'.
This can represent ANSI SQL DATE, TIME, and TIMESTAMP literals (such as DATE '2020-01-01'),
as well as constants of other types (a non-standard PostgreSQL extension).
Function(Function)Scalar function call e.g. LEFT(foo, 5)
CASE [<operand>] WHEN <condition> THEN <result> ... [ELSE <result>] END
Note we only recognize a complete single expression as <condition>,
not < 0 nor 1, 2, 3 as allowed in a <simple when clause> per
https://jakewheat.github.io/sql-overview/sql-2011-foundation-grammar.html#simple-when-clause
Fields of Case
An exists expression EXISTS(SELECT ...), used in expressions like
WHERE EXISTS (SELECT ...).
A parenthesized subquery (SELECT ...), used in expression like
SELECT (subquery) AS x or WHERE (subquery) = x
ListAgg(ListAgg)The LISTAGG function SELECT LISTAGG(...) WITHIN GROUP (ORDER BY ...)
Trait Implementations
impl Clone for Expr[src]
impl Debug for Expr[src]
impl Display for Expr[src]
impl Eq for Expr[src]
impl Hash for Expr[src]
fn hash<__H: Hasher>(&self, state: &mut __H)[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<Expr> for Expr[src]
impl StructuralEq for Expr[src]
impl StructuralPartialEq for Expr[src]
Auto Trait Implementations
impl RefUnwindSafe for Expr[src]
impl Send for Expr[src]
impl Sync for Expr[src]
impl Unpin for Expr[src]
impl UnwindSafe for Expr[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,