[plainto_tsquery] using OR - Mailing list pgsql-general

From Sven R. Kunze
Subject [plainto_tsquery] using OR
Date
Msg-id 5565A5FF.5010701@tbz-pariv.de
Whole thread Raw
List pgsql-general
Hi everybody,

I struggle to find a clean solution in an application to safely parse
the query input string of a user.

Currently, I am inclined to split the string with some magic regex and
build it safely together using ' | '. That solution, however, is
error-prone and hides the powerful features of tsquery that PostgreSQL
could provide from the user.

Is there a way to safely create a tsquery out of user's input?
Optionally, when the user types '&', '|', '!' '(' and ')' it could be
interpreted like typical tsquery syntax BUT still creates valid tsquery.

Regards,

--
Sven R. Kunze
TBZ-PARIV GmbH, Bernsdorfer Str. 210-212, 09126 Chemnitz
Tel: +49 (0)371 33714721, Fax: +49 (0)371 5347920
e-mail: srkunze@tbz-pariv.de
web: www.tbz-pariv.de

Geschäftsführer: Dr. Reiner Wohlgemuth
Sitz der Gesellschaft: Chemnitz
Registergericht: Chemnitz HRB 8543



pgsql-general by date:

Previous
From: Albe Laurenz
Date:
Subject: Re: Re: duplicate key value violates unique constraint "pg_class_relname_nsp_index"
Next
From: Melvin Davidson
Date:
Subject: Re: duplicate key value violates unique constraint "pg_class_relname_nsp_index"