Skip to content

Commit 2ab8227

Browse files
Fix CI: Allow FuncCall nodes to use :: syntax with parentheses
The original implementation allowed FuncCall nodes to use :: syntax (with parentheses for precedence), but the initial refactoring incorrectly marked them as needing CAST() syntax. This fix updates argumentNeedsCastSyntax() to return false for FuncCall nodes, allowing the existing FuncCall handling code to run and wrap them in parentheses. Fixes snapshot test failures: - pg-catalog.test.ts: (public.gen_random_uuid())::text - misc-pretty.test.ts: (t.date AT TIME ZONE 'America/New_York')::text All 657 tests now pass. Co-Authored-By: Dan Lynch <[email protected]>
1 parent 7365f32 commit 2ab8227

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/deparser/src/deparser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2446,6 +2446,11 @@ export class Deparser implements DeparserVisitor {
24462446
private argumentNeedsCastSyntax(argNode: any): boolean {
24472447
const argType = this.getNodeType(argNode);
24482448

2449+
// FuncCall nodes can use :: syntax (TypeCast will add parentheses)
2450+
if (argType === 'FuncCall') {
2451+
return false;
2452+
}
2453+
24492454
// Simple constants and column references can use :: syntax
24502455
if (argType === 'A_Const' || argType === 'ColumnRef') {
24512456
// Check for A_Const with special cases that might need CAST syntax

0 commit comments

Comments
 (0)