【发布时间】:2018-03-18 01:27:27
【问题描述】:
我有一个项目,我使用 PostgreSQL 9.5 作为 RDBMS 和 Liquibase 3.5.3 来生成数据库实体。我想使用以下 XML 在表上创建索引:
<createIndex indexName="idx_entity_audit_event_entity_id"
tableName="jhi_entity_audit_event">
<column name="entity_id" type="bigint"/>
</createIndex>
生成的SQL命令如下:
CREATE INDEX public.idx_entity_audit_event_entity_id ON
public.jhi_entity_audit_event(entity_id)
执行 Liquibase 变更集时,出现以下错误:
Reason: liquibase.exception.DatabaseException: ERROR: syntax error at or near "."
Position: 20 [Failed SQL: CREATE INDEX public.idx_entity_audit_event_entity_id ON public.jhi_entity_audit_event(entity_id)]
我也尝试在 pgAdmin 4 中手动执行上述脚本,但遇到了同样的错误。我试图再次手动重新创建索引,但是我从索引名称中跳过了架构名称 public 并且它起作用了。
我不确定这是否是 Liquibase 或 Postgres 问题,或者仅仅是 Liquibase 和 Postgres 版本不同步,但我无法使其正常工作。如果有人有想法,请与我和社区分享。
【问题讨论】:
标签: xml postgresql indexing syntax-error liquibase