pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: esemmano@gmail.com
Subject: BUG #18479: websearch_to_tsquery inconsistent behavior for german when using parentheses
Date: Fri, 24 May 2024 07:02:28 +0000
Message-ID: <18479-d9b46e2fc242c33e@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      18479
Logged by:          Manos Emmanouilidis
Email address:      esemmano@gmail.com
PostgreSQL version: 15.4
Operating system:   macOS Sonoma 14.4.1 x86
Description:        

Although the docs
https://www.postgresql.org/docs/current/textsearch-controls.html say nothing
about websearch_to_tsquery supporting parentheses in queries, I noticed some
inconsistent behaviour when using multiple 'or' keywords with parentheses in
postgres 15.4

In the following tests 1-3 the behaviour matches what I expect, but in the
4th test the 'or' keyword is used verbatim when parentheses are present in
the middle of the query.

select websearch_to_tsquery('german', 'foo or baz bar');
 websearch_to_tsquery
-----------------------
 'foo' | 'baz' & 'bar'

select websearch_to_tsquery('german', 'foo or baz bar or ding dong');
          websearch_to_tsquery
-----------------------------------------
 'foo' | 'baz' & 'bar' | 'ding' & 'dong'

select websearch_to_tsquery('german', 'foo or baz bar or (ding dong)');
          websearch_to_tsquery
-----------------------------------------
 'foo' | 'baz' & 'bar' | 'ding' & 'dong'

select websearch_to_tsquery('german', 'foo or (baz bar) or (ding dong)');
              websearch_to_tsquery
------------------------------------------------
 'foo' | 'baz' & 'bar' & 'or' & 'ding' & 'dong'

I do not mean to say that this is necessarily a bug that needs fixing, but
maybe either the docs should call out that using parens leads to undefined
behaviour, or the function's logic could be updated to be consistent in the
presence of parens - either ignore them completely or always consider them,
but not both depending on the input



view thread (3+ messages)  latest in thread

Message-ID: <18479-d9b46e2fc242c33e@postgresql.org>
Permalink:  ../18479-d9b46e2fc242c33e@postgresql.org/
Also on:    postgresql.org/message-id/18479-d9b46e2fc242c33e@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, esemmano@gmail.com
  Subject: Re: BUG #18479: websearch_to_tsquery inconsistent behavior for german when using parentheses
  In-Reply-To: <18479-d9b46e2fc242c33e@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox