pgsql: Avoid creating duplicate ordered append paths

From: Richard Guo <rguo(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid creating duplicate ordered append paths
Date: 2025-11-05 09:13:16
Message-ID: E1vGZZs-00583Q-1m@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Avoid creating duplicate ordered append paths

In generate_orderedappend_paths(), the function does not handle the
case where the paths in total_subpaths and fractional_subpaths are
identical. This situation is not uncommon, and as a result, it may
generate two exactly identical ordered append paths.

Fix by checking whether total_subpaths and fractional_subpaths contain
the same paths, and skipping creation of the ordered append path for
the fractional case when they are identical.

Given the lack of field complaints about this, I'm a bit hesitant to
back-patch, but let's clean it up in HEAD.

Author: Richard Guo <guofenglinux(at)gmail(dot)com>
Reviewed-by: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Reviewed-by: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Discussion: https://postgr.es/m/CAMbWs4-OYsgA75tGGiBARt87G0y_z_GBTSLrzudcJxAzndYkYw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0ea5eee37606386150aa8317184617e1d5d34565

Modified Files
--------------
src/backend/optimizer/path/allpaths.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Richard Guo 2025-11-05 09:16:25 pgsql: Fix assertion failure in generate_orderedappend_paths()
Previous Message Michael Paquier 2025-11-05 07:48:52 pgsql: Fix timing-dependent failure in recovery test 004_timeline_switc