postgres/src/backend/access
Peter Geoghegan 796962922e Always commute strategy when preprocessing DESC keys.
A recently added nbtree preprocessing step failed to account for the
fact that DESC columns already had their B-Tree strategy number commuted
at this point in preprocessing.  As a result, preprocessing could output
a set of scan keys where one or more keys had the correct strategy
number, but used the wrong comparison routine.

To fix, make the faulty code path that looks up a more restrictive
replacement operator/comparison routine commute its requested inequality
strategy (while outputting the transformed strategy number as before).
This makes the final transformed scan key comport with the approach
preprocessing has always used to deal with DESC columns (which is
described by comments above _bt_fix_scankey_strategy).

Oversight in commit commit b3f1a13f, which made nbtree preprocessing
perform transformations on skip array inequalities that can reduce the
total number of index searches.

Author: Peter Geoghegan <pg@bowt.ie>
Reported-By: Natalya Aksman <natalya@timescale.com>
Discussion: https://postgr.es/m/19049-b7df801e71de41b2@postgresql.org
Backpatch-through: 18
2025-09-12 13:23:00 -04:00
..
brin Remove unneeded casts of BufferGetPage() result 2025-08-29 07:18:29 +02:00
common Silence compiler warnings on clang 21 2025-09-12 07:28:32 +02:00
gin Remove unneeded casts of BufferGetPage() result 2025-08-29 07:18:29 +02:00
gist Silence compiler warnings on clang 21 2025-09-12 07:28:32 +02:00
hash Remove unneeded casts of BufferGetPage() result 2025-08-29 07:18:29 +02:00
heap Add error codes when vacuum discovers VM corruption 2025-09-08 17:13:31 -04:00
index Use ereport() rather than elog() 2025-08-22 13:35:05 +03:00
nbtree Always commute strategy when preprocessing DESC keys. 2025-09-12 13:23:00 -04:00
rmgrdesc Add more information for WAL records of hash index AMs 2025-09-12 10:29:02 +09:00
sequence Update copyright for 2025 2025-01-01 11:21:55 -05:00
spgist Remove unneeded casts of BufferGetPage() result 2025-08-29 07:18:29 +02:00
table Fix varatt versus Datum type confusions 2025-08-05 12:11:36 +02:00
tablesample Update copyright for 2025 2025-01-01 11:21:55 -05:00
transam Fix leak with SMgrRelations in startup process 2025-09-10 07:23:05 +09:00
Makefile Introduce sequence_*() access functions 2024-02-26 16:04:59 +09:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00