pgsql: Fix YA text phrase search bug.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix YA text phrase search bug.
Date: 2020-05-07 20:00:06
Message-ID: E1jWmgg-0001CD-VF@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix YA text phrase search bug.

checkcondition_str() failed to report multiple matches for a prefix
pattern correctly: it would dutifully merge the match positions, but
then after exiting that loop, if the last prefix-matching word had
had no suitable positions, it would report there were no matches.
The upshot would be failing to recognize a match that the query
should match.

It looks like you need all of these conditions to see the bug:
* a phrase search (else we don't ask for match position details)
* a prefix search item (else we don't get to this code)
* a weight restriction (else checkclass_str won't fail)

Noted while investigating a problem report from Pavel Borisov,
though this is distinct from the issue he was on about.

Back-patch to 9.6 where phrase search was added.

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e1d70ba438a29dd03ba1ce77dcb54c0df9c4f904

Modified Files
--------------
src/backend/utils/adt/tsvector_op.c | 8 +++++++-
src/test/regress/expected/tstypes.out | 18 ++++++++++++++++++
src/test/regress/sql/tstypes.sql | 3 +++
3 files changed, 28 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-05-07 20:00:07 pgsql: Fix YA text phrase search bug.
Previous Message Tom Lane 2020-05-07 18:25:44 pgsql: Doc: update remaining tables of functions/operators for new layo