-
Notifications
You must be signed in to change notification settings - Fork 29
Description
Summary
Following the fix in PR #222 for function qualifier normalization (issue #220), we're still seeing perpetual diffs when policy expressions reference tables with same-schema qualifiers.
Context
PR #222 correctly normalizes function calls like public.auth_uid() → auth_uid(). However, the same issue exists for table references within policy expressions.
Reproduction
Schema file contains:
CREATE POLICY "Select own orders" ON orders
FOR SELECT TO authenticated
USING (user_id IN (
SELECT u.id
FROM users u -- no public. prefix
WHERE u.tenant_id = (SELECT public.current_tenant_id())
));pgschema generates DDL with:
FROM public.users u -- adds public. prefixBut PostgreSQL's pg_get_expr() returns:
FROM users u -- no public. prefixThis creates a perpetual diff where pgschema always wants to ALTER the policy.
Expected Behavior
Table references within policy expressions should be normalized the same way function calls are in PR #222—strip same-schema qualifiers during comparison.
Related
- Issue Policy expressions show perpetual diff due to schema qualification mismatch #220 (function qualifiers in policies)
- PR fix: normalize policy expression schema qualifiers #222 (fix for Policy expressions show perpetual diff due to schema qualification mismatch #220)
- Issue Schema qualifiers stripped from column default expressions #218 (schema qualifiers in column defaults)
Reactions are currently unavailable