我的SQL Server数据库中有以下索引
CREATE NONCLUSTERED INDEX XCR_ACTIVE ON dbo.CS_PA_VEH_BASE ( ETL_ACTIVE_FL ) WHERE ETL_ACTIVE_FL = 'N' ON "default";
liquibase
为此提供了以下内容:
<createIndex indexName="XCR_ACTIVE" tableName="CS_PA_VEH_DELTA">
<column computed="true" name="([ETL_ACTIVE_FL]='N')"/>
</createIndex>
但是当我想执行它时(也在MS SQL Server中),我得到以下信息
> **Error:** (14.2) 05-24-19 11:43:05 (E) (13004:15088) RUN-050304: |Session JOB_ODS_Liquibase Function call <raise_exception ( Liquibase
> update error: 1: Unexpected error running Liquibase: Incorrect syntax
> near '('. [Failed SQL: CREATE NONCLUSTERED INDEX XCR_ACTIVE ON
> [dbo].[CS_PA_VEH_DELTA](([ETL_ACTIVE_FL]='N'))] ) > failed, due to
> error <50316>: <Liquibase update error:-1: Unexpected error running
> Liquibase: Incorrect syntax near '('. [Failed SQL: CREATE NONCLUSTERED
> INDEX XCR_ACTIVE ON [dbo].[CS_PA_VEH_DELTA](([ETL_ACTIVE_FL]='N'))]>.
我希望这不是第一次发生在某人身上。
答案 0 :(得分:0)
在标准Liquibase文档中未提及“带过滤器的索引”: https://www.liquibase.org/documentation/changes/create_index.html 但是内森在http://forum.liquibase.org/topic/how-to-create-conditional-indexes-using-createindex?reply=true中提到的有关ModifySQL的内容应该可以使用。