Skip to content

Commit 3ff387f

Browse files
Fix issue #217: Wrap FuncCall arguments in parentheses when using :: cast syntax
- Fixes operator precedence issues with double casts like CAST(...AS text)::date - Wraps FuncCall arguments (e.g., AT TIME ZONE expressions) in parentheses - Prevents :: operator from binding to wrong operand - Refactored empty if block to pass lint checks - Updated pg-catalog snapshot to reflect correct parenthesization Co-Authored-By: Dan Lynch <[email protected]>
1 parent 95ae97e commit 3ff387f

File tree

2 files changed

+2977
-2971
lines changed

2 files changed

+2977
-2971
lines changed

packages/deparser/__tests__/misc/__snapshots__/pg-catalog.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
exports[`should format pg_catalog.char with pretty option enabled 1`] = `
44
"CREATE TABLE dashboard_jobs.jobs (
55
id bigserial PRIMARY KEY,
6-
queue_name text DEFAULT public.gen_random_uuid()::text,
6+
queue_name text DEFAULT (public.gen_random_uuid())::text,
77
task_identifier text NOT NULL,
88
payload pg_catalog.json DEFAULT '{}'::json NOT NULL,
99
priority int DEFAULT 0 NOT NULL,

0 commit comments

Comments
 (0)