From: | Benjamin Arai <me(at)benjaminarai(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Checking is TSearch2 query is valid |
Date: | 2007-09-10 05:23:26 |
Message-ID: | 500554F8-D3FF-48D2-A461-3A748BA1EA0F@benjaminarai.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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, Tom Lane wrote:
> Benjamin Arai <me(at)benjaminarai(dot)com> 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 generic solution to this type of problem is to write a function
> that
> tries to do whatever-it-is-that-throws-an-error inside a plpgsql
> BEGIN/EXCEPTION block, and catch the errors you are expecting.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | Max Zorloff | 2007-09-10 06:31:25 | Re: Connection pooling |
Previous Message | Ron Johnson | 2007-09-10 04:28:07 | Re: Time Zone design issues |