Tsearch2: casting text to tsquery - Mailing list pgsql-general

From Alexander Presber
Subject Tsearch2: casting text to tsquery
Date
Msg-id 7401E94B-9890-40A9-A50D-E50867864906@weisshuhn.de
Whole thread Raw
Responses Re: Tsearch2: casting text to tsquery  (Oleg Bartunov <oleg@sai.msu.su>)
List pgsql-general
Hello,

I have a question that arose while using tsearch on a large database
of book information.

In order to inject unstemmed + stemmed versions of searchstrings into
a query we want to cast an expression of type text to tsquery.
Unfortunately

   SELECT 'word'::tsquery

(where the literal 'word' is of type 'unknown' seemingly) works just
fine while e.g.

   SELECT ('word' || '&fullword')::tsquery

or, simpler

   SELECT 'word&fullword'::text::tsquery

gives

   ERROR:  cannot cast type text to tsearch2.tsquery

How can we work around that? Thanks for any help

Sincerely yours
Alexander Presber




pgsql-general by date:

Previous
From: Sebastian Böck
Date:
Subject: Re: Bug with index-usage?
Next
From: Thies C Arntzen
Date:
Subject: shouldn't postgres know the numer of rows in a (sorted) result-set before returning the first row?