postgresql/src/backend/utils
Tom Lane 2d7808e6fc Fix LIKE/regex optimization for indexscan with exact-match pattern.
Commit 85b7efa1c introduced support for LIKE with non-deterministic
collations.  By moving some conditionals around, it accidentally broke
the optimization for converting a LIKE or regex exact-match pattern
to an equality indexqual when the index collation doesn't match the
expression collation.  That should be allowed if the expression
collation is deterministic.  This patch re-introduces the optimization
for that common case.

One important beneficiary of this optimization is the "\d tablename"
command in psql.  Without this fix that will do a seqscan on pg_class
instead of an index point lookup.

Reported-by: Andres Freund <andres@anarazel.de>
Author: Jelte Fennema-Nio <postgres@jeltef.nl>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/DHBQIZX8SZVI.ZX614ZMFL645@jeltef.nl
Backpatch-through: 18
2026-07-06 13:06:24 -04:00
..
activity Improve checks and error messages of pgstat_register_kind() 2026-07-06 10:49:28 +09:00
adt Fix LIKE/regex optimization for indexscan with exact-match pattern. 2026-07-06 13:06:24 -04:00
cache Fix qual pushdown past grouping with mismatched equivalence 2026-07-06 16:13:14 +09:00
error Fix syslogger NULL-pointer-dereference in EXEC_BACKEND 2026-06-08 19:49:54 +02:00
fmgr Remove bits* typedefs. 2026-03-30 16:12:08 -05:00
hash Fix 64-bit shifting in dynahash.c 2026-04-19 13:27:54 +02:00
init Fix md5_password_warnings for role and database settings 2026-06-12 08:32:39 +09:00
mb Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
misc Add log_statement_max_length GUC to limit logged statement text 2026-07-03 08:47:18 +09:00
mmgr Pre-beta mechanical code beautification, step 1: run pgindent. 2026-05-13 10:34:17 -04:00
resowner Fix unsafe order of operations in ResourceOwnerReleaseAll(). 2026-06-22 18:03:23 -04:00
sort Cosmetic fixes for radix sort 2026-04-29 16:14:25 +07:00
time Fix valgrind failure 2026-04-07 11:13:50 +02:00
.gitignore Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:02:39 +09:00
errcodes.txt Update copyright for 2026 2026-01-01 13:24:10 -05:00
Gen_dummy_probes.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
Gen_fmgrtab.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
generate-errcodes.pl Update copyright for 2026 2026-01-01 13:24:10 -05:00
Makefile Fix build inconsistency due to the generation of wait-event code 2026-02-02 08:02:39 +09:00
meson.build Update copyright for 2026 2026-01-01 13:24:10 -05:00
postprocess_dtrace.sed Update copyright for 2026 2026-01-01 13:24:10 -05:00
probes.d Update copyright for 2026 2026-01-01 13:24:10 -05:00