Pampa Nello
Pampa Nello

Reputation: 242

How to create table names without quotes using Liquibase and Postgres?

I am running a changelog script against Postgres,

<createTable tableName="FREE_ME_FROM_THE_QUOTES">
    <column name="ID" type="NUMERIC">
        <constraints nullable="false" primaryKey="true"/>
    </column>
...

but for some unknown reason the table name is always created in this format public."FREE_ME_FROM_THE_QUOTES", I have tried to use objectQuotingStrategy, but the result is always the same.

Is there a way to create tables (using Liquibase) with a name that does not include quotation marks?

Something like public.FREE_ME_FROM_THE_QUOTES, just to be clear.

Upvotes: 0

Views: 1557

Answers (1)

Guilherme Mussi
Guilherme Mussi

Reputation: 1057

It is not possible, because your name contains upper-letter characters.

If you create your tables with <createTable tableName="free_me_from_the_quotes"> then you will create a case-insensitive table. Then, all the following selects will work:

  • select * from Free_Me_From_the_Quotes
  • select * from free_me_from_the_quotes
  • SELECT * FROM FREE_ME_FROM_THE_QUOTES

If you are using with hibernate, for example, this is the best approach.

Upvotes: 3

Related Questions