DatabaseMetadata with quoted names

Description

I am trying to use your org.hibernate.tool.hbm2ddl.DatabaseMetadata in my own purposes. I found that it works more or less well when table names are unquoted. But it does not work correctly in case of using quoted identifiers. E.g. it does not work in HSQLDB. In method getTableMetadata you use methods storesUpperCaseIdentifiers and storesLowerCaseIdentifiers to uppercase or lowercase the table names. But it is not correctly for quoted identifiers.

Possibly we should have some tag (boolean quoted) which will specify using quoted identifiers in system and use the following methods instead: storesUpperCaseQuotedIdentifiers, storesLowerCaseQuotedIdentifiers and possibly supportsMixedCaseQuotedIdentifiers.

Environment

HSQLDB 1.8.0.3

Activity

Show:
GavinG
November 29, 2005, 4:57 PM

This is not a public API.

Andrey Grebnev
December 3, 2005, 8:08 AM

Are you sure that all other classes which use this class will work correctly in case quoted identifiers?

Darius Schier
March 27, 2006, 1:46 PM

I've recognized exactly the same problems with PostgreSQL. Sure it is used by public APIs (as SchemaUpdate).

The problem is even slightly worse, as the table names that are read out of the table mappings still contain the quote sign. That means, even if your quoted name and the default behaviour of your database would match, the name would not be found.

But maybe this is the clue how to handle it:

  • ask the DatabaseMetaData about the quote sign (getIdentifierQuoteString)

  • if the table name embraced by quotes: use the stores*QuotedIdentifiers methods

  • else: business as usual

Would you mind to reopen this issue?

Rejected

Assignee

Unassigned

Reporter

Andrey Grebnev

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure