Skip to content

fix(deparser): quote policy names in DROP POLICY and COMMENT ON POLICY - #373

Merged
pyramation merged 1 commit into
mainfrom
devin/1793488373-policy-name-quoting
Oct 31, 2026
Merged

pyramation merged 1 commit into
mainfrom
devin/1793488373-policy-name-quoting

Conversation

@pyramation

Copy link
Copy Markdown
Collaborator

Summary

Policy names that need quoting (e.g. "Users can view own data") were emitted unquoted or in an invalid form, so the output no longer parsed:

DROP POLICY "own todos" ON public.t               -- before: DROP POLICY own todos ON public.t
COMMENT ON POLICY "own todos" ON public.t IS 'x'  -- before: COMMENT ON POLICY public.t."own todos" IS 'x'
  • DropStmt (OBJECT_POLICY): name parts now go through QuoteUtils.quoteIdentifier instead of raw sval.
  • CommentStmt (OBJECT_POLICY): handles the 3-part schema, table, policy list (previously only 2-part).

Regression fixture misc/policy-quoted-names.sql fails before the fix and passes after; full deparser suite passes (749 tests).

Link to Devin session: https://app.devin.ai/sessions/274a911e2422452599d0f1215f6d9f8f
Open in Devin Desktop: https://app.devin.ai/desktop/session/274a911e2422452599d0f1215f6d9f8f?variant=devin
Requested by: @pyramation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@tenki-reviewer

tenki-reviewer Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


Improves deparse fidelity for CREATE POLICY names containing spaces or special characters by quoting identifiers in the DROP POLICY output path, and adds fixture coverage to lock the behavior in.

Files Change
packages/deparser/src/deparser.ts Applies QuoteUtils.quoteIdentifier to policy names in the DROP POLICY deparse branch so quoted identifiers round-trip correctly.
__fixtures__/kitchen-sink/misc/policy-quoted-names.sql New kitchen-sink fixture exercising policy names with spaces and special characters.
packages/deparser/__tests__/kitchen-sink/misc-policy-quoted-names.test.ts Round-trip test enumerating the new quoted-name policy cases.
__fixtures__/generated/generated.json Regenerated fixture catalog including the new policy entries.

Reviewed commit: 7e5320d

@pyramation
pyramation merged commit ce9bbb4 into main Oct 31, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant