我正在尝试在rails迁移中在Heroku上的共享postgresql数据库上创建自定义索引:
-- execute("create index on items using gin(to_tsvector('english', name));")
rake aborted!
An error has occurred, this and all later migrations canceled:
PGError: ERROR: syntax error at or near "on"
LINE 1: create index on items using gin(to_tsvector('english', name)...
^
: create index on items using gin(to_tsvector('english', name));
它在开发中工作正常,postgresql是通过Homebrew(9.1)
安装的答案 0 :(得分:2)
来自postgres手册:
CREATE [ UNIQUE ] INDEX [ CONCURRENTLY ] name ON table [ USING method ]
( { column | ( expression ) } [ opclass ] [, ...] )
[ WITH ( storage_parameter = value [, ... ] ) ]
[ TABLESPACE tablespace ]
[ WHERE predicate ]
我认为你错过了索引的NAME。