Skip to main content

as_boolean

Function as_boolean 

Source
pub fn as_boolean(val: &str) -> Option<bool>
Expand description

Interpret a lowercased string as a PostgreSQL boolean value.

PostgreSQL accepts unambiguous prefixes of true, false, yes, no, on, off, plus the numeric literals 1 and 0. A bare o is rejected because it is ambiguous between on and off.

This helper is exposed so callers can interpret a SetValue::Literal payload — the parser itself never resolves boolean semantics, because a single GUC value might be boolean in one context and a literal string in another.