是否可以在 sqlite 中使用“索引”作为列名?

cre*_*ijn 2 sqlite hibernate

是否可以index在sqlite中用作列名?

当我尝试执行此查询时,它是使用 hibernate/jpa 生成的:

select
    metadatait0_.id as id25_,
    metadatait0_.guid as guid25_,
    metadatait0_.index as index25_,
    metadatait0_.library_section_id as library7_25_,
    metadatait0_.metadata_type as metadata4_25_,
    metadatait0_.parent_id as parent5_25_,
    metadatait0_.title as title25_ 
from
    metadata_items metadatait0_
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140)
...
Caused by: java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "index": syntax error)
Run Code Online (Sandbox Code Playgroud)

Ale*_*sky 6

尝试在方括号中包含列名:

metadatait0_.[index] as index25_,
Run Code Online (Sandbox Code Playgroud)