Closed se-neaxplore closed 7 months ago
If you are using the default result set builder, what you get back from next.jdbc
is what the JDBC driver provides as table and column names.
If you are using as-unqualified-maps
, what you get back from next.jdbc
is what the JDBC driver provides as column names.
Only if you use the -lower
variant builders will next.jdbc
attempt to lower-case anything.
Given that you are not stropping the column names in the DDL or aliases in the SQL, I would actually expect them to come back as lowercase with several databases (and as UPPERCASE with others).
SQL is not case-sensitive by definition (although some databases violate this definition). Some databases (and their drivers) behave as if everything were UPPERCASE (e.g., H2), some databases (and their drivers) behave as if everything were lowercase. A few have some aspects of case sensitivity -- MySQL treats table names as case sensitive if the host O/S is case sensitive but treats column names as case insensitive (so MySQL table names are case sensitive on Linux, but case insensitive on Windows and macOS!).
The way to get case sensitivity is to strop the identifiers (quote them) in the DDL and SQL.
None of this is happening in next.jdbc
-- this is just how databases and their drivers work.
Big thanks for the detailed answer and taking the time to break it down. It was super helpful.
Appreciate it!
Describe the bug Queriying a postgres database, the column name casing is not preserved.
To Reproduce
Running the following queries:
Expected behavior
The column names should be preserved, or respect the
AS
name.From the docs:
as-unqualified-maps -- simple keywords as-is, e.g., :ID, :firstName,
https://github.com/seancorfield/next-jdbc/blob/develop/doc/result-set-builders.md
deps.edn
Environment: