Thread: [plainto_tsquery] using OR

[plainto_tsquery] using OR

From
"Sven R. Kunze"
Date:
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