jOOQ / jOOQ

jOOQ is the best way to write SQL in Java
https://www.jooq.org
Other
6.13k stars 1.21k forks source link

Add a new Settings.parseNameCase #9238

Closed lukaseder closed 4 years ago

lukaseder commented 5 years ago

The DDLDatabase has a configuration option called defaultNameCase, which governs the name case for unquoted identifiers. This is relevant when e.g. a statement like

create table x (i int);

Is executed. Depending on the dialect, this would produce either a table X (e.g. Oracle) or a table x (e.g. PostgreSQL).

This feature needs to be moved into the core as a Settings, such that new functionality, like DDL simulation can decide what case it should translate unquoted identifiers to.

The different options are:

The different values for DEFAULT are:

a parseDialect parseNameCase
DEFAULT UPPER_IF_UNQUOTED (as specified in the SQL standard)
ACCESS AS_IS (?)
ASE AS_IS
COCKROACHDB LOWER_IF_UNQUOTED
DB2 UPPER_IF_UNQUOTED
DERBY UPPER_IF_UNQUOTED
FIREBIRD UPPER_IF_UNQUOTED
H2 UPPER_IF_UNQUOTED
HANA UPPER_IF_UNQUOTED (?)
HSQLDB UPPER_IF_UNQUOTED
INFORMIX LOWER_IF_UNQUOTED
INGRES UPPER_IF_UNQUOTED (?)
MARIADB AS_IS (table names in fact depend on the lower_case_table_names flag, see #9795)
MEMSQL AS_IS (table names in fact depend on the lower_case_table_names flag, see #9795)
MYSQL AS_IS (table names in fact depend on the lower_case_table_names flag, see #9795)
ORACLE UPPER_IF_UNQUOTED
POSTGRES LOWER_IF_UNQUOTED
REDSHIFT LOWER (will be fixed through #9865)
SQLDATAWAREHOUSE AS_IS
SQLITE AS_IS
SQLSERVER AS_IS
SYBASE AS_IS
TERADATA UPPER_IF_UNQUOTED (?)
VERTICA LOWER_IF_UNQUOTED

We could use the Settings.renderLocale for this, but probably it would be better to also introduce a separate, independent Settings.parseLocale

lukaseder commented 4 years ago

This flag should now be used wherever there is ambiguity with respect to the name case.