Skip to main content

Function Argument Formatting

Controls function call formatting including argument newlines.

Arguments stay on one line while they fit, and go one per line when they do not.

Applies to: Regular function calls (count(), sum()), special functions (COALESCE, GREATEST, LEAST), and schema-qualified functions.

Nesting: Each function resolves its arg newline mode independently. Outer vertical + inner compact is supported.

Simple function calls

select count(*), sum(a) from t
select count(*), sum(a) from t

Binary expressions

select a + b, c * d from t
select a + b, c * d from t

String literal

select 'hello' from t
select 'hello' from t

Column and table aliases

select a as alias1 from t
select a as alias1 from t

Table alias

select t.a from tbl t
select t.a from tbl t

SELECT star

select * from t
select * from t

COALESCE always vertical

select coalesce(a, b, c) from t
select coalesce(a, b, c) from t

COALESCE never keeps compact

select coalesce(
a,
b,
c
) from t
select coalesce(a, b, c) from t

COALESCE auto compact

The call fits, so it stays on one line.

select coalesce(a, b, c) from t
select coalesce(a, b, c) from t

COALESCE auto vertical via open paren newline

Written across lines, but it fits — so it comes back on one. Author breaks are not preserved unless preserveBreaks says so.

select coalesce(
a, b, c) from t
select coalesce(a, b, c) from t

COALESCE auto vertical via comma newlines

Same again with the breaks after the commas: the layout is decided by width.

select coalesce(a,
b,
c) from t
select coalesce(a, b, c) from t

Single arg stays compact in auto

select coalesce(a) from t
select coalesce(a) from t

Nested functions both vertical

select coalesce(
a, coalesce(
b, c)) from t
select coalesce(a, coalesce(b, c)) from t

Nested functions outer vertical inner compact

select coalesce(
a, coalesce(b, c)) from t
select coalesce(a, coalesce(b, c)) from t

Deeply nested special functions with always vertical

With functionArgNewline=always, each nested SpecialFunction (COALESCE, NULLIF, GREATEST, LEAST) should break its own args onto indented lines independently.

select coalesce(nullif(greatest(a, b), 0), least(c, d)) from t
select coalesce(nullif(greatest(a, b), 0), least(c, d)) from t

Function args with leading comma

select coalesce(a, b, c) from t
select coalesce(a, b, c) from t

Width-aware: GREATEST args that exceed the width break one per line

An argument list either fits on one line or breaks one item per line — no filling.

select greatest(alpha, bravo, charlie,
delta, echo, foxtrot,
golf) from t
select
greatest(
alpha,
bravo,
charlie,
delta,
echo,
foxtrot,
golf
)
from t

Width-aware: COALESCE args that exceed the width break one per line

select coalesce(alpha, bravo,
charlie, delta,
echo) from t
select
coalesce(
alpha,
bravo,
charlie,
delta,
echo
)
from t

Table-valued function in FROM glues its paren to the name

The argument list of a FROM-position table function is its own grammar product behind an optional field, so the FUNCTION_NAME role promotion (same-product only) cannot reach it. The grammar declares the call-suffix glueLeftProduct instead: no space before the paren, while the arguments stay free to break.

select * from read_csv('a.csv', delim = ',') as t
select * from read_csv('a.csv', delim = ',') as t

Schema-qualified table function in FROM

select * from db.schema.fn(1, 2) as t
select * from db.schema.fn(1, 2) as t