Skip to content

LQL parser rejects 2-arg current_setting() in policy USING / function bodyLql #64

@MelbourneDeveloper

Description

@MelbourneDeveloper

Summary

The LQL transpiler accepts only 1-arg current_setting('name') in policy using: predicates and in function bodyLql: blocks, and auto-emits the second missing_ok=true argument when lowering to SQL.

The standard PostgreSQL current_setting(name, missing_ok) 2-arg form is rejected with:

LQL-PARSE: policy '<name>': current_setting() requires exactly one string-literal argument

Why this matters

Authors who know stock PostgreSQL reach for the 2-arg form when they want explicit missing_ok=true semantics on a GUC that may be unset. They write what works on a psql prompt and the migrate fails at apply time, not parse time, with an opaque LQL-PARSE error.

Repro

policies:
  - name: example
    using: "current_setting('app.tenant_id', true) = ''"

→ LQL-PARSE error.

policies:
  - name: example
    using: "current_setting('app.tenant_id') = ''"

→ Accepted; transpiler emits current_setting('app.tenant_id', true) = '' (correct).

Proposed fix

Either:

  1. Accept the 2-arg form and pass through verbatim (idiomatic PG), OR
  2. Update the LQL-PARSE error to point at the 1-arg convention and the auto-missing_ok behaviour.

Found via

tenants_self_membership_select RLS policy in NimblesiteAgenticPlatform/migrations/schema.yaml (PR #119).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions