pgsql: Fix tuplesort optimization for CLUSTER-on-expression.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix tuplesort optimization for CLUSTER-on-expression.
Date: 2022-04-03 22:58:39
Message-ID: E1nb9B8-000CIi-F1@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix tuplesort optimization for CLUSTER-on-expression.

When dispatching sort operations to specialized variants, commit
69749243 failed to handle the case where CLUSTER-sort decides not to
initialize datum1 and isnull1. Fix by hoisting that decision up a level
and advertising whether datum1 can be relied on, in the Tuplesortstate
object.

Per reports from UBsan and Valgrind build farm animals, while running
the cluster.sql test.

Reviewed-by: Andres Freund <andres(at)anarazel(dot)de>
Discussion: https://postgr.es/m/CAFBsxsF1TeK5Fic0M%2BTSJXzbKsY6aBqJGNj6ptURuB09ZF6k_w%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/cc58eecc5d75a9329a6d49a25a6499aea7ee6fd6

Modified Files
--------------
src/backend/utils/sort/tuplesort.c | 78 +++++++++++++++++++++++++++-----------
1 file changed, 56 insertions(+), 22 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message David Rowley 2022-04-04 08:53:46 pgsql: Improve the generation memory allocator
Previous Message Tom Lane 2022-04-03 21:04:50 pgsql: Fix portability issues in datetime parsing.