Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/syntax/expr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export const exprMap: CstToDocMap<AllExprNodes> = {
// For now this check here patches up the deficiency in the parser.
!grandParent.distinctKw &&
!isSelectStmt(node.expr) &&
!isCompoundSelectStmt(node.expr)
!isCompoundSelectStmt(node.expr) &&
// (a, b) is a single row argument, not two arguments
!isListExpr(node.expr)
) {
return print("expr");
}
Expand Down
6 changes: 6 additions & 0 deletions test/expr/expr.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@ describe("expr", () => {
`);
});

it(`preserves parenthesis around row constructor inside function arguments`, async () => {
await testPostgresql(dedent`
SELECT array_position(ids, (1, 1)) FROM tbl
`);
});

describe("case", () => {
it(`formats CASE expression always on multiple lines`, async () => {
await test(dedent`
Expand Down