exasol / virtual-schemas

Entry point repository for the EXASOL Virtual Schemas
http://www.exasol.com
MIT License
24 stars 23 forks source link

Support postgres unquoted identifier handling #74

Closed snehlsen closed 5 years ago

snehlsen commented 5 years ago

Problem

postgres is incompatible to the SQL standard when it comes to identifiers:

The folding of unquoted names to lower case in PostgreSQL is incompatible with the SQL standard, which says that unquoted names should be folded to upper case. Thus, foo should be equivalent to "FOO" not "foo" according to the standard.

(https://www.postgresql.org/docs/current/sql-syntax-lexical.html)

EXASOL is SQL standard compliant: all unquoted identifiers are folded to upper case. Since the adapter is quoting all identifiers (since v1.1.1), there is an upper case / lower case mismatch that leads to an error.

Proposed solution

The postgres adapter dialect converts all identifiers to lower case. This way the virtual schema integration between exasol and postgres will work seamlessly if you don't use quoted upper case identifiers in postgres. If you have tables with upper case characters in postgres, creating or refreshing the virtual schema will result in an error. You can still create the schema if you set a FORCE_CREATE property when creating the virtual schema.

andrehacker commented 5 years ago

I just think if it would be better to make the force more specific. There will likely be other use cases for forcing in future (e.g. unsupported column types is a known problem) and then the user will not find out about potential other problems after setting the force option once for the reason of unsupported qualifiers. I.e. the force could be also named like "ignore all kinds of warnings" which might be too generic.

Also a short note there is the property exception_handling, which is related. Maybe it needs to become a list, but didn't think through...

snehlsen commented 5 years ago

Fixed in Adapter v1.4.0