postgres/contrib/pg_trgm
Tom Lane 327b7324d0 Put "excludeOnly" GIN scan keys at the end of the scankey array.
Commit 4b754d6c1 introduced the concept of an excludeOnly scan key,
which cannot select matching index entries but can reject
non-matching tuples, for example a tsquery such as '!term'.  There are
poorly-documented assumptions that such scan keys do not appear as the
first scan key.  ginNewScanKey did nothing to ensure that, however,
with the result that certain GIN index searches could go into an
infinite loop while apparently-equivalent queries with the clauses in
a different order were fine.

Fix by teaching ginNewScanKey to place all excludeOnly scan keys
after all not-excludeOnly ones.  So far as we know at present,
it might be sufficient to avoid the case where the very first
scan key is excludeOnly; but I'm not very convinced that there
aren't other dependencies on the ordering.

Bug: #19031
Reported-by: Tim Wood <washwithcare@gmail.com>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/19031-0638148643d25548@postgresql.org
Backpatch-through: 13
2025-08-26 12:08:57 -04:00
..
data Add files forgotten in f576b17cd6 2016-03-16 19:23:41 +03:00
expected Put "excludeOnly" GIN scan keys at the end of the scankey array. 2025-08-26 12:08:57 -04:00
sql Put "excludeOnly" GIN scan keys at the end of the scankey array. 2025-08-26 12:08:57 -04:00
.gitignore
Makefile Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00
pg_trgm--1.1--1.2.sql Add word_similarity to pg_trgm contrib module. 2016-03-16 18:59:21 +03:00
pg_trgm--1.2--1.3.sql Make contrib modules' installation scripts more secure. 2020-08-10 10:44:42 -04:00
pg_trgm--1.3--1.4.sql Add strict_word_similarity to pg_trgm module 2018-03-21 14:57:42 +03:00
pg_trgm--1.3.sql Remove support for upgrading extensions from "unpackaged" state. 2020-02-19 16:59:14 -05:00
pg_trgm--1.4--1.5.sql Fix typo in contrib/pg_trgm/pg_trgm--1.4--1.5.sql 2020-11-12 08:55:09 +03:00
pg_trgm--1.5--1.6.sql Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
pg_trgm--1.0--1.1.sql
pg_trgm.control Handle equality operator in contrib/pg_trgm 2020-11-15 08:52:35 +03:00
trgm_gin.c New header varatt.h split off from postgres.h 2023-01-10 05:54:36 +01:00
trgm_gist.c Remove various unnecessary (char *) casts 2025-02-20 19:49:27 +01:00
trgm_op.c Use PG_MODULE_MAGIC_EXT in our installable shared libraries. 2025-03-26 11:11:02 -04:00
trgm_regexp.c Update copyright for 2025 2025-01-01 11:21:55 -05:00
trgm.h Fix an issue with index scan using pg_trgm due to char signedness on different architectures. 2025-02-21 10:27:39 -08:00