postgresql/src/backend
Alexander Korotkov 0c4f355c6a Fix parsing of complex morphs to tsquery
When to_tsquery() or websearch_to_tsquery() meet a complex morph containing
multiple words residing adjacent position, these words are connected
with OP_AND operator.  That leads to surprising results.  For instace,
both websearch_to_tsquery('"pg_class pg"') and to_tsquery('pg_class <-> pg')
produce '( pg & class ) <-> pg' tsquery.  This tsquery requires
'pg' and 'class' words to reside on the same position and doesn't match
to to_tsvector('pg_class pg').  It appears to be ridiculous behavior, which
needs to be fixed.

This commit makes to_tsquery() or websearch_to_tsquery() connect words
residing adjacent position with OP_PHRASE.  Therefore, now those words are
normally chained with other OP_PHRASE operator.  The examples of above now
produces 'pg <-> class <-> pg' tsquery, which matches to
to_tsvector('pg_class pg').

Another effect of this commit is that complex morph word positions now need to
match the tsvector even if there is no surrounding OP_PHRASE.  This behavior
change generally looks like an improvement but making this commit not
backpatchable.

Reported-by: Barry Pederson
Bug: #16592
Discussion: https://postgr.es/m/16592-70b110ff9731c07d@postgresql.org
Discussion: https://postgr.es/m/CAPpHfdv0EzVhf6CWfB1_TTZqXV_2Sn-jSY3zSd7ePH%3D-%2B1V2DQ%40mail.gmail.com
Author: Alexander Korotkov
Reviewed-by: Tom Lane, Neil Chen
2021-01-31 20:14:29 +03:00
..
access Retire pg_standby. 2021-01-29 14:09:41 +13:00
bootstrap Update copyright for 2021 2021-01-02 13:06:25 -05:00
catalog Add primary keys and unique constraints to system catalogs 2021-01-30 19:44:29 +01:00
commands Adjust comments of CheckRelationTableSpaceMove() and SetRelationTableSpace() 2021-01-29 13:59:18 +09:00
executor Fix hash partition pruning with asymmetric partition sets. 2021-01-28 13:41:55 -05:00
foreign Update copyright for 2021 2021-01-02 13:06:25 -05:00
jit Update copyright for 2021 2021-01-02 13:06:25 -05:00
lib Update copyright for 2021 2021-01-02 13:06:25 -05:00
libpq Move SSL information callback earlier to capture more information 2021-01-22 09:26:27 +09:00
main Update copyright for 2021 2021-01-02 13:06:25 -05:00
nodes Allow GRANTED BY clause in normal GRANT and REVOKE statements 2021-01-30 09:45:11 +01:00
optimizer Fix error with CREATE PUBLICATION, wal_level=minimal, and new tables. 2021-01-30 00:11:38 -08:00
parser Allow GRANTED BY clause in normal GRANT and REVOKE statements 2021-01-30 09:45:11 +01:00
partitioning Fix hash partition pruning with asymmetric partition sets. 2021-01-28 13:41:55 -05:00
po Translation updates 2020-05-18 12:49:30 +02:00
port Update copyright for 2021 2021-01-02 13:06:25 -05:00
postmaster Add pg_stat_database counters for sessions and session time 2021-01-17 13:52:31 +01:00
regex Fix ancient bug in parsing of BRE-mode regular expressions. 2021-01-08 12:16:00 -05:00
replication Fix two typos in snapbuild.c. 2021-01-25 12:15:10 -08:00
rewrite Update copyright for 2021 2021-01-02 13:06:25 -05:00
snowball Update copyright for 2021 2021-01-02 13:06:25 -05:00
statistics Update copyright for 2021 2021-01-02 13:06:25 -05:00
storage Fix CREATE INDEX CONCURRENTLY for simultaneous prepared transactions. 2021-01-30 00:00:27 -08:00
tcop Improve performance of repeated CALLs within plpgsql procedures. 2021-01-25 22:28:29 -05:00
tsearch Fix parsing of complex morphs to tsquery 2021-01-31 20:14:29 +03:00
utils Revive "snapshot too old" with wal_level=minimal and SET TABLESPACE. 2021-01-30 00:12:18 -08:00
.gitignore
common.mk
Makefile Update copyright for 2021 2021-01-02 13:06:25 -05:00
nls.mk Add missing gettext triggers 2020-04-28 13:35:40 +02:00