CTE names on a new line
cteNamesOnNewLine decides whether the first CTE begins on the line after with, indented one
level, or rides the with line itself.
Default: true. with stands alone at the top, every CTE name starts a line at the same
indent, and the main query starts back at column zero. A reader finds the names by scanning one
column, and the with clause is visibly a block that ends where the indent does.
false puts the first CTE on the with line: with recent as (. The other CTEs have no indented
first line to line up with, so they begin at with's own column. It is the shape a lot of
hand-written SQL has, and a project formatting a large existing corpus may prefer the smaller diff.
Two CTEs, both ways
with recent as (select customer_id from orders), older as (select customer_id from archive) select * from recent join older using (customer_id)with
recent as (select customer_id from orders),
older as (select customer_id from archive)
select *
from recent
join older using (customer_id)with recent as (select customer_id from orders), older as (select customer_id from archive) select * from recent join older using (customer_id)with recent as (select customer_id from orders),
older as (select customer_id from archive)
select *
from recent
join older using (customer_id)The empty line between the two CTEs is blankLineBetweenCtes' doing, not this option's.