pgsql: Fix CLUSTER tuplesorts on abbreviated expressions.

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема pgsql: Fix CLUSTER tuplesorts on abbreviated expressions.
Дата
Msg-id E1nhKWH-000LTz-O2@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Fix CLUSTER tuplesorts on abbreviated expressions.

CLUSTER sort won't use the datum1 SortTuple field when clustering
against an index whose leading key is an expression.  This makes it
unsafe to use the abbreviated keys optimization, which was missed by the
logic that sets up SortSupport state.  Affected tuplesorts output tuples
in a completely bogus order as a result (the wrong SortSupport based
comparator was used for the leading attribute).

This issue is similar to the bug fixed on the master branch by recent
commit cc58eecc5d.  But it's a far older issue, that dates back to the
introduction of the abbreviated keys optimization by commit 4ea51cdfe8.

Backpatch to all supported versions.

Author: Peter Geoghegan <pg@bowt.ie>
Author: Thomas Munro <thomas.munro@gmail.com>
Discussion: https://postgr.es/m/CA+hUKG+bA+bmwD36_oDxAoLrCwZjVtST2fqe=b4=qZcmU7u89A@mail.gmail.com
Backpatch: 10-

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1272630a249798a0fce6a00383c78f8129434523

Modified Files
--------------
src/backend/utils/sort/tuplesort.c    |  4 +++-
src/test/regress/expected/cluster.out | 14 ++++++++++++++
src/test/regress/sql/cluster.sql      |  6 ++++++
3 files changed, 23 insertions(+), 1 deletion(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Disallow infinite endpoints in generate_series() for timestamps.
Следующее
От: Peter Geoghegan
Дата:
Сообщение: pgsql: vacuumlazy.c: MultiXactIds are MXIDs, not XMIDs.