[−][src]Struct postgres_parser::sys::CaseExpr
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: Expr
casetype: Oid
casecollid: 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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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]
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,
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, 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.
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>,