Re: new function for tsquery creartion

Dmitry Ivanov <d.ivanov@postgrespro.ru>

From: Dmitry Ivanov <d.ivanov@postgrespro.ru>
To: Aleksandr Parfenov <a.parfenov@postgrespro.ru>
Cc: Aleksander Alekseev <a.alekseev@postgrespro.ru>, Thomas Munro <thomas.munro@enterprisedb.com>, David Steele <david@pgmasters.net>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2018-04-01T20:00:43Z
Lists: pgsql-hackers

Attachments

Hi Aleksandr,

> I agree with Aleksander about silencing all errors in 
> websearch_to_tsquery().
> 
> In the attachment is a revised patch with the attempt to introduce an
> ability to ignore syntax errors in gettoken_tsvector().

Thanks for the further improvements! Yes, you're both right, the API has 
to be consistent. Unfortunately, I had to make some adjustments 
according to Oleg Bartunov's review. Here's a change log:

1. &, | and (), <-> are no longer considered operators in web search 
mode.
2. I've stumbled upon a bug: web search used to transform "pg_class" 
into 'pg <-> class', which is no longer the case.
3. I changed the behavior of gettoken_tsvector() as soon as I had heard 
from Aleksander Alekseev, so I decided to use my implementation in this 
revision of the patch. This is a good subject for discussion, though. 
Feel free to share your opinion.
4. As suggested by Theodor, I've replaced some bool args with bit flags.

> The name of enum ts_parsestate looks more like a name of the function
> than a name of a type.
> In my version, it renamed to QueryParserState, but you can fix it if 
> I'm wrong.

True, but gettoken_query() returns ts_tokentype, so I decided to use 
this naming scheme.

-- 
Dmitry Ivanov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Commits

  1. Add websearch_to_tsquery

  2. Add psql variables to track success/failure of SQL queries.

  3. Wording improvements