Marc Polizzi
Marc Polizzi

Reputation: 9375

jdbc : postgres and quoted column names

Is there any way to determine in JDBC that a column or table has been created using "" notation? The metadata get columns does not seem to return such information.

PS: our customer model has been unfortunately created in such a way :-(

Upvotes: 3

Views: 566

Answers (1)

user330315
user330315

Reputation:

If the column name is returned in mixed case or all upper then it has been created using quotes.

So if columnName.equals(columnName.toLowerCase()) == true then no quotes were used. Or to be more prices: no quotes are needed.

Note that this is Postgres specific. Other databases store unquoted names in uppercase, some store them "as-is" without requiring quotes.

Upvotes: 2

Related Questions