Skip to main content

parse_policy_expr

Function parse_policy_expr 

Source
pub fn parse_policy_expr(sql: &str) -> Result<Expr, String>
Expand description

Parse a raw SQL policy expression from pg_policies into a typed Expr AST.

Handles the common RLS patterns:

  • col = current_setting('var', true)::type (tenant check)
  • (current_setting('var', true))::boolean = true (session bool check)
  • expr1 OR expr2 / expr1 AND expr2 (combinators)

Returns an error for unsupported expressions.