Re: tsearch2 headline() query subselect help

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: John Smith <jayzee(dot)smith(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: tsearch2 headline() query subselect help
Date: 2007-01-11 01:32:57
Message-ID: 1168479177.2411.12.camel@dogma.v10.wvs
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 2007-01-10 at 19:14 -0500, John Smith wrote:
> guys,
> how'd i make this query work?
> select headline(select column_1 from table_1 where to_tsvector
> (column_1) @@ to_tsquery('ftp'),'ftp'::tsquery);
> ERROR: syntax error at or near "select" at character 17
>

After taking a closer look, why don't you just write it simply like:

select headline(column_1,'ftp'::tsquery) from table_1 where to_tsvector
(column_1) @@ to_tsquery('ftp');

If you do it as a subquery, the subquery can't return multiple values,
and it looks like you expect it to.

Jeff Davis

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mike Poe 2007-01-11 01:38:38 Question - Query based on WHERE OR
Previous Message Radovan Jablonov 2007-01-11 01:14:27 plpgsql trapping full detail error message