Skip to main content

Function case

functionCase sets the case of function names: count, sum, coalesce, cast, current_date, and the function part of a schema-qualified call such as my_schema.my_func().

Default: like_keyword. A function name is cased exactly as keywordCase cases keywords, so one setting gives SELECT COUNT(*) rather than SELECT count(*), and with keywordCase at its own default of preserve function names keep the case you wrote. Set upper, lower or preserve to case them on their own. lower under upper-case keywords is the usual request: a call then reads as a call rather than as more syntax.

Upper-case keywords, functions on their own​

select count(*), sum(a), cast(x as int) from t
SELECT COUNT(*), SUM(a), CAST(x AS INT) FROM t
select count(*), sum(a), cast(x as int) from t
SELECT count(*), sum(a), cast(x AS INT) FROM t

cast is a function, so it moved. AS is a keyword, and INT is a data type, which has its own option.

What it leaves alone. A quoted function name is exactly the characters between the quotes: in PostgreSQL "MyFunc" and "MYFUNC" are two different functions, so "MyFunc"() is never re-cased. The schema in my_schema.my_func() is a name, and names are identifierCase's. On ClickHouse function names are compared as written (toString is a function and tostring is not), so the option does nothing there.

A quoted name is never re-cased​

select "MyFunc"(1), my_schema."MyFunc"(2), my_func(3) from t
select "MyFunc"(1), my_schema."MyFunc"(2), MY_FUNC(3) from t

Where the case of a function changes a result. On seven engines a select item with no alias is named after its own text, so re-casing a word inside one renames a column of the result. The list and the reasoning are on Keyword casing; the hazard belongs to the unaliased item, not to functions in particular.