Search Postgresql Archives

Re: text type has no default operator class for GIN?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux