Re: Problem creating GIN index on multiple weighted columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ryan Fugger <arv(at)ryanfugger(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Problem creating GIN index on multiple weighted columns
Date: 2011-08-18 21:36:20
Message-ID: 5942.1313703380@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ryan Fugger <arv(at)ryanfugger(dot)com> writes:
> I'm using 8.4.8, attempting to run the following command:
> => create index profile_search_index on profile_profile using
> gin(setweight(to_tsvector('english', name), 'A') ||
> setweight(to_tsvector('english', description), 'B'));

> I get this error:

> ERROR: syntax error at or near "||"
> LINE 1: ... gin(setweight(to_tsvector('english', name), 'A') || setweig...
> ^

> Is this a bug, or a known limitation, or is my syntax just wrong?

The latter. You need an extra pair of parentheses around any index
expression that's more complicated than a single function call.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pete Wall 2011-08-18 21:58:17 Problem with 8.3.14 Windows binaries
Previous Message Ryan Fugger 2011-08-18 21:21:48 Problem creating GIN index on multiple weighted columns