我只能像这样重现您的错误消息:
denis=# create index test_idx on test (val varchar_pattern_ops);CREATE INDEXdenis=# alter table test alter val type int using (val::int);ERROR: operator class "varchar_pattern_ops" does not accept data type integer
如果您有这样一个时髦的索引,请尝试像这样删除并重新创建它:
denis=# drop index test_idx;DROP INDEXdenis=# create index test_idx on test (val);CREATE INDEXdenis=# alter table test alter val type int using (val::int);ALTER TABLE
相关文档:
http://www.postgresql.org/docs/current/static/indexes-
opclass.html



