Reputation: 42853
I have column col
with data type CHARACTER VARYING
I need that index this column as gin
index. If trying directly set gin index to column, returned error:
data type character varying 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
If trying:
create index col_vector
on mytable
using gin (to_tsvector(col))
I got error: functions in index expression must be marked IMMUTABLE
How to create gin
index for CHARACTER VARYING
column ?
p.s. I need this for full text search
Upvotes: 13
Views: 15706
Reputation: 4487
Try This Code:
CREATE INDEX "name " ON "tablename" USING gin(to_tsvector('english', "columnname"));
Upvotes: 21