[][src]Struct postgres_parser::sys::CaseExpr

#[repr(C)]pub struct CaseExpr {
    pub xpr: Expr,
    pub casetype: Oid,
    pub casecollid: Oid,
    pub arg: *mut Expr,
    pub args: *mut List,
    pub defresult: *mut Expr,
    pub location: c_int,
}

CaseExpr a CASE expression

We support two distinct forms of CASE expression: CASE WHEN boolexpr THEN expr [ WHEN boolexpr THEN expr ... ] CASE testexpr WHEN compexpr THEN expr [ WHEN compexpr THEN expr ... ] These are distinguishable by the "arg" field being NULL in the first case and the testexpr in the second case.

In the raw grammar output for the second form, the condition expressions of the WHEN clauses are just the comparison values. Parse analysis converts these to valid boolean expressions of the form CaseTestExpr '=' compexpr where the CaseTestExpr node is a placeholder that emits the correct value at runtime. This structure is used so that the testexpr need be evaluated only once. Note that after parse analysis, the condition expressions always yield boolean.

Note: we can test whether a CaseExpr has been through parse analysis yet by checking whether casetype is InvalidOid or not.

Fields

xpr: Exprcasetype: Oidcasecollid: Oid

type of expression result

arg: *mut Expr

OID of collation, or InvalidOid if none

args: *mut List

implicit equality comparison argument

defresult: *mut Expr

the arguments (list of WHEN clauses)

location: c_int

the default result (ELSE clause)

Trait Implementations

impl Debug for CaseExpr[src]

impl Default for CaseExpr[src]

impl Eq for CaseExpr[src]

impl Hash for CaseExpr[src]

impl PartialEq<CaseExpr> for CaseExpr[src]

impl StructuralEq for CaseExpr[src]

impl StructuralPartialEq for CaseExpr[src]

Auto Trait Implementations

impl RefUnwindSafe for CaseExpr

impl !Send for CaseExpr

impl !Sync for CaseExpr

impl Unpin for CaseExpr

impl UnwindSafe for CaseExpr

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.