Re: text type has no default operator class for GIN? - Mailing list pgsql-general

From Sam Mason
Subject Re: text type has no default operator class for GIN?
Date
Msg-id 20090818234721.GS5407@samason.me.uk
Whole thread Raw
In response to Re: text type has no default operator class for GIN?  (Bob Gobeille <bob.gobeille@hp.com>)
Responses Re: text type has no default operator class for GIN?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Tue, Aug 18, 2009 at 03:50:47PM -0600, Bob Gobeille wrote:
> On Aug 18, 2009, at 3:46 PM, Gobeille, Robert wrote:
> >CREATE INDEX "ufile_name_search" ON "public"."uploadtree" USING GIN
> >("ufile_name");
> >
> >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.
[..]
> I still don't understand the above, but the following works:
>
> create index ufile_name_ginidx on uploadtree using
> gin(to_tsvector('english', ufile_name));

Not sure if understand very well myself, but GIN indexes can only speed
up specific access patterns and these are exposed through various
different operators.

When PG refuses to create a GIN index on a plain TEXT column it's saying
that it doesn't how to use those operators with a values of TEXT type.
As soon as you pull this value apart (with the to_tsvector) you end up
with something that PG can get some traction on and all is good.

Maybe a useful question to ask is, what are you expecting PG do to when
you create a GIN index on this TEXT column?

--
  Sam  http://samason.me.uk/

pgsql-general by date:

Previous
From: Adam Rich
Date:
Subject: Re: Postgre RAISE NOTICE and PHP
Next
From: Tom Lane
Date:
Subject: Re: text type has no default operator class for GIN?