如何使用 Liquibase 和 Postgres 创建 table 个不带引号的名称?
How to create table names without quotes using Liquibase and Postgres?
我是 运行 针对 Postgres 的更新日志脚本,
<createTable tableName="FREE_ME_FROM_THE_QUOTES">
<column name="ID" type="NUMERIC">
<constraints nullable="false" primaryKey="true"/>
</column>
...
但由于某些未知原因,table 名称始终以这种格式创建 public."FREE_ME_FROM_THE_QUOTES"
,我尝试使用 objectQuotingStrategy
,但结果始终相同。
有没有办法使用不包含引号的名称创建 tables(使用 Liquibase)?
类似于 public.FREE_ME_FROM_THE_QUOTES
,只是为了清楚。
不可能,因为你的名字包含大写字母。
如果您使用 <createTable tableName="free_me_from_the_quotes">
创建 table,那么您将创建不区分大小写的 table。
然后,以下所有 selects 将起作用:
- select * 来自 Free_Me_From_the_Quotes
- select * 来自 free_me_from_the_quotes
- SELECT * 来自 FREE_ME_FROM_THE_QUOTES
例如,如果您使用休眠,这是最好的方法。
我是 运行 针对 Postgres 的更新日志脚本,
<createTable tableName="FREE_ME_FROM_THE_QUOTES">
<column name="ID" type="NUMERIC">
<constraints nullable="false" primaryKey="true"/>
</column>
...
但由于某些未知原因,table 名称始终以这种格式创建 public."FREE_ME_FROM_THE_QUOTES"
,我尝试使用 objectQuotingStrategy
,但结果始终相同。
有没有办法使用不包含引号的名称创建 tables(使用 Liquibase)?
类似于 public.FREE_ME_FROM_THE_QUOTES
,只是为了清楚。
不可能,因为你的名字包含大写字母。
如果您使用 <createTable tableName="free_me_from_the_quotes">
创建 table,那么您将创建不区分大小写的 table。
然后,以下所有 selects 将起作用:
- select * 来自 Free_Me_From_the_Quotes
- select * 来自 free_me_from_the_quotes
- SELECT * 来自 FREE_ME_FROM_THE_QUOTES
例如,如果您使用休眠,这是最好的方法。