Re: Tsearch2 - Error using tsquery object in GROUP BBY - Mailing list pgsql-general

From Teodor Sigaev
Subject Re: Tsearch2 - Error using tsquery object in GROUP BBY
Date
Msg-id 456FEE37.8060500@sigaev.ru
Whole thread Raw
In response to Tsearch2 - Error using tsquery object in GROUP BBY queries  (Henrik Zagerholm <henke@mac.se>)
Responses Re: Tsearch2 - Error using tsquery object in GROUP BBY  (Henrik Zagerholm <henke@mac.se>)
List pgsql-general
> The query I'm executing has a GROUP BY clause and because I'm using the
> headline function I need my tsquery object in the SELECT clause and
> therefor also in the GROUP BY clause.
> BUT when executing the query I get the following error. -> "could not
> identify an ordering operator for type tsquery"

Which version do you use? Only 8.2 will have comparison operator for tsquery.

>
> How do I solve this?
Use subselect:
SELECT *, headline(..., to_tsquery()) FROM
{
    SELECT .... GROUP BY ...
);

BTW, for performance reason, it might be useful to use limit in inner select -
headline function is slow enough.


--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/

pgsql-general by date:

Previous
From: "Isak Hansen"
Date:
Subject: Re: Separation of clients' data within a database
Next
From: Matthew Peter
Date:
Subject: named cache