From: Tom Lane <tgl@sss.pgh.pa.us>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: tim.connolly@oovvuu.com <tim.connolly@oovvuu.com>
Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17125: Operator precedence bug in websearch_to_tsquery function
Date: Wed, 28 Jul 2021 10:13:35 -0400
Message-ID: <575790.1627481615@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKFQuwa2v2F9spFbJgnDey9pNtk-R3TOOAJ1VU6fGTD5=Mm4DQ@mail.gmail.com>
References: <17125-483838072f5f4bac@postgresql.org>
<CAKFQuwa2v2F9spFbJgnDey9pNtk-R3TOOAJ1VU6fGTD5=Mm4DQ@mail.gmail.com>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tuesday, July 27, 2021, PG Bug reporting form <noreply@postgresql.org>
> wrote:
>> postgres=# select websearch_to_tsquery('english', 'foo bar or baz');
>> websearch_to_tsquery
>> -----------------------
>> 'foo' & 'bar' | 'baz'
>> (1 row)
>>
>> Expected: 'foo' & ('bar' | 'baz')
> The documentation describes the operator precedence and it isn’t what you
> expect.
It does appear from what I could find on the web that Google does it
the other way. Whether that's enough reason to change a behavior
that's stood since v11 is hard to say. We're not trying to be
entirely bug-compatible with Google here ... and even if we were,
who's to say whether they might not change this tomorrow?
Perhaps a more useful way to think about it is whether it's possible
to get the behavior opposite to the default. AFAICS there isn't any
way to get 'a & (b | c)' out of websearch_to_tsquery. However, if
we changed the default precedence, then there'd be no way to get the
old behavior, which is not nice at all. I first thought that maybe
you could write '"a b" or c', but that produces 'a <-> b | c' which
isn't the same.
Anyway, given that most people probably have no idea about this fine
point, I doubt that the benefits of changing it would outweigh the
costs.
regards, tom lane
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: tgl@sss.pgh.pa.us, david.g.johnston@gmail.com, tim.connolly@oovvuu.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17125: Operator precedence bug in websearch_to_tsquery function
In-Reply-To: <575790.1627481615@sss.pgh.pa.us>
* 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