lbitonti / liquibase-hana

Liquibase Hana extension
Apache License 2.0
11 stars 11 forks source link

DB-Identifiers are always quoted and are thus case sensitive #16

Open pichlerm opened 6 years ago

pichlerm commented 6 years ago

We use Liquibase to create tables used with Hibernate and plain SQL statements.

Currently we use lower case or mixed case identifiers for table/column/sequence names.

This works with OracleDatabase where the DB converts all unquoted identifiers to uppercase names, both on creation with Liquibase and later on access via Hibernate or plain SQL.

It also works with MSSQLDatabase where the (always) quoted identifiers are matched case insensitively in queries.

In HanaDBDatabase you always add quotes to the identifiers (Liquibase 3.x: QUOTE_ALL_OBJECTS; Liquibase 2.x: escapeDatabaseObject) which causes tables/columns/sequences to be created in the unchanged writing (not uppercased by the HANA DB). When using the same identifiers within Hibernate or plain SQL statements without quotes, they are converted to uppercase and do not match.

Our workaround was to implement HanaDBDatabase#escapeDatabaseObject (we are still using Liquibase 2.x) the same way as for OracleDatabase, causing quotes to be only added for non-word characters or reserved words (which we don't use). Thus it works the same way as with Oracle Databases (auto-uppercase both by Liquibase and on use in Hibernate and SQL statements).