websearch_to_tsquery() and apostrophe inside double quotes - Mailing list pgsql-general

From Alastair McKinley
Subject websearch_to_tsquery() and apostrophe inside double quotes
Date
Msg-id DB6PR0202MB29042F00F80B87CE187BD2B6E3940@DB6PR0202MB2904.eurprd02.prod.outlook.com
Whole thread Raw
Responses Re: websearch_to_tsquery() and apostrophe inside double quotes
List pgsql-general
Hi all,

I am a little confused about what us being generated by websearch_to_tsquery() in the case of an apostrophe inside double quotes.

Here is an example of searching for a name containing an apostrophe.

The following works as expected:

select to_tsvector('peter o''toole') @@ websearch_to_tsquery('peter o''toole');
 ?column?
----------
 t
(1 row)


When the name is in double quotes, the search fails:

select to_tsvector('peter o''toole') @@ websearch_to_tsquery('"peter o''toole"');
 ?column?
----------
 f
(1 row)

In the first case, websearch_to_tsquery() returns:

select websearch_to_tsquery('peter o''toole');
  websearch_to_tsquery  
------------------------
 'peter' & 'o' & 'tool'
(1 row)

which makes sense to me.

In the second case websearch_to_tsquery() returns something that I can't quite understand:

select websearch_to_tsquery('"peter o''toole"');
     websearch_to_tsquery    
------------------------------
 'peter' <-> ( 'o' & 'tool' )
(1 row)

I am not quite sure what text this will actually match?

Best regards,

Alastair


pgsql-general by date:

Previous
From: Timmy Siu
Date:
Subject: Minimum privilege for Backup and replication
Next
From: Luca Ferrari
Date:
Subject: Re: Minimum privilege for Backup and replication