Thursday, 16 August 2012

PG ERROR While creating GIN Index

Hi,

I am getting below error while creating GIN Index in rails through migration

rake aborted!
An error has occurred, this and all later migrations cancelled:

PG::Error: ERROR:  data type text has no default operator class for access method "gin"
HINT:  You must specify an operator class for the index or define a default operator class for the data type.
: CREATE INDEX discussions_gin_question ON discussions USING GIN(question)

Tasks: TOP => db:migrate
(See full trace by running task with --trace)


After goggling I came to see its due to not making that column as to_tsvector

I have changed my migration to execute as below

CREATE INDEX products_gin_question ON products USING GIN(to_tsvector('english', question))


Thank You,
Uma Mahesh.

No comments:

Post a Comment