【发布时间】:2018-06-06 20:12:18
【问题描述】:
尝试实施对其他问题提出的建议:
我已经编写了这个迁移来删除当前索引并创建新索引:
class ChangeIndexes < ActiveRecord::Migration[5.1]
def change
remove_index :part_masters, name: "part_masters_on_combo_idx"
execute <<-SQL
CREATE INDEX ON part_masters (lower(unaccent(combo)) text_pattern_ops);
CREATE INDEX ON locations (lower(unaccent(ubicacion)) text_pattern_ops);
SQL
end
end
问题是我收到了这个错误,我想是因为我使用了 lower 或 unaccent 之类的函数来创建索引:
PG::InvalidObjectDefinition: ERROR: functions in index expression must be marked IMMUTABLE
【问题讨论】:
标签: ruby-on-rails postgresql activerecord