Postgresql operator class “varchar_pattern_ops” does not accept data type integer

后端 未结 2 1037
一整个雨季
一整个雨季 2021-01-05 06:56

I\'m trying migrate my data id postgresql from string to integers in django to use them in sphinx search. So first of all I\'m making data migration, converting my data to i

2条回答
  •  感动是毒
    2021-01-05 07:07

    I'm only able to reproduce your error message like so:

    denis=# create index test_idx on test (val varchar_pattern_ops);
    CREATE INDEX
    denis=# alter table test alter val type int using (val::int);
    ERROR:  operator class "varchar_pattern_ops" does not accept data type integer
    

    If you've a funky index like that, try dropping and recreating it like so:

    denis=# drop index test_idx;
    DROP INDEX
    denis=# create index test_idx on test (val);
    CREATE INDEX
    denis=# alter table test alter val type int using (val::int);
    ALTER TABLE
    

    Related docs:

    http://www.postgresql.org/docs/current/static/indexes-opclass.html

提交回复
热议问题