Keyword Casing
Controls the case of SQL keywords (SELECT, FROM, WHERE, etc.).
Community conventions:
- UPPERCASE: Traditional SQL, ANSI standard, most enterprise tools (Oracle, DB2, TSQL)
- lowercase: Modern data engineering (dbt, PostgreSQL community, DuckDB)
- PRESERVE: Keep original casing from source code
Interaction with other options:
functionCaseis independent — you can have UPPER keywords with lower function namesdataTypeCaseis independent — you can have lower keywords with UPPER data types
Uppercase keywords (default ANSI)
select a from t where x > 1
select a from t where x > 1
Lowercase keywords
SELECT a FROM t WHERE x > 1
select a from t where x > 1
Preserve keyword case
Select a From t Where x > 1
Select a From t Where x > 1
Uppercase identifiers (default ANSI)
select myCol from myTable
select mycol from mytable
Preserve identifiers
select MyCol from MyTable
select MyCol from MyTable
Quoted identifiers preserved
Quoting is how a dialect says "this name is exactly these characters", so "MyCol" and "mycol"
are two different columns. identifierCase reaches unquoted names only.
select "MyCol" from "MyTable"
select "MyCol" from "MyTable"
Lowercase identifiers (postgres-style)
SELECT MyCol FROM MyTable
select mycol from mytable
PostgreSQL-style defaults
PostgreSQL defaults: lower keywords, lower identifiers.
SELECT a, b FROM t WHERE x > 1
select a, b from t where x > 1
Mixed case keywords normalized
Inconsistent casing from hand-written SQL is normalized.
Select A, b FROM t Where X > 1 Group By a Order By b
select a, b from t where x > 1 group by a order by b
Unary operators glue to their operand
-90 is one thing to read, - 90 is two. The operator binds to the operand with no space, and the
operand still lays out normally — a negated parenthesized expression keeps its own spacing.
select dateadd(day, -90, current_date), -1 * x, (-1), -count(*), -(a + b), +1, ~5, 3 * -2 from t
select
dateadd(day, -90, current_date),
-1 * x,
(-1),
-count(*),
-(a + b),
+1,
~5,
3 * -2
from t
Gluing stops short of changing the token stream
Two unary minuses in a row must keep their space: -- starts a line comment, so gluing here would
swallow the rest of the line. Binary minus is unaffected either way.
select - -1, a - -b, 1 - 90 from t
select - -1, a - -b, 1 - 90 from t