Re: [GENERAL] Checking is TSearch2 query is valid

2008-03-12 Thread Bruce Momjian
Add psql TODO: o Include the symbolic SQLSTATE name in verbose error reports http://archives.postgresql.org/pgsql-general/2007-09/msg00438.php --- Alvaro Herrera wrote: Tom Lane wrote: Benjamin Arai

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-10 Thread Tom Lane
Benjamin Arai [EMAIL PROTECTED] writes: Is there a specific exception code for: ERROR: no operand in tsearch query: ( regression=# \set VERBOSITY verbose regression=# select to_tsquery('('); ERROR: 42601: no operand in tsearch query: ( LOCATION: gettoken_query, tsquery.c:163 Seems to be

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-10 Thread Alvaro Herrera
Tom Lane wrote: Benjamin Arai [EMAIL PROTECTED] writes: Is there a specific exception code for: ERROR: no operand in tsearch query: ( regression=# \set VERBOSITY verbose regression=# select to_tsquery('('); ERROR: 42601: no operand in tsearch query: ( LOCATION: gettoken_query,

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-09 Thread Benjamin Arai
That is helpful but these functions to do help me detect errors in queries such as (moose frog where the left parentheses is missing. I may just have to write a lexical analyzer. Benjamin On Sep 8, 2007, at 10:45 PM, Oleg Bartunov wrote: There are two useful functions - numnode() and

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-09 Thread Tom Lane
Benjamin Arai [EMAIL PROTECTED] writes: Is there a way to pass a query to PostgreSQL to check if the TSeasrch2 search text is valid? For example, SELECT to_tsquery('default', '!'); returns an error. I want to know if there is a way get true/false for the '!' portion of the query? The

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-09 Thread Benjamin Arai
Ok, this appears to have worked but I have to check for exception code OTHERS because I could not figure out what the actual code being thrown was. Is there a specific exception code for: ERROR: no operand in tsearch query: ( Thanks for the help! Benjamin On Sep 9, 2007, at 7:54 AM,

[GENERAL] Checking is TSearch2 query is valid

2007-09-08 Thread Benjamin Arai
Is there a way to pass a query to PostgreSQL to check if the TSeasrch2 search text is valid? For example, SELECT to_tsquery('default', '!'); returns an error. I want to know if there is a way get true/false for the '!' portion of the query? Benjamin ---(end of

Re: [GENERAL] Checking is TSearch2 query is valid

2007-09-08 Thread Oleg Bartunov
There are two useful functions - numnode() and querytree() More details in http://www.sai.msu.su/~megera/postgres/fts/doc/fts-query.html Oleg On Sat, 8 Sep 2007, Benjamin Arai wrote: Is there a way to pass a query to PostgreSQL to check if the TSeasrch2 search text is valid? For example,