pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Rowley <drowley@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix misleading comment for get_cheapest_group_keys_order
Date: Mon, 19 Sep 2022 22:03:56 +0000
Message-ID: <E1oaOrr-0016RT-HV@gemulon.postgresql.org> (raw)

Fix misleading comment for get_cheapest_group_keys_order

The header comment for get_cheapest_group_keys_order() claimed that the
output arguments were set to a newly allocated list which may be freed by
the calling function, however, this was not always true as the function
would simply leave these arguments untouched in some cases.

This tripped me up when working on 1349d2790 as I mistakenly assumed I
could perform a list_concat with the output parameters.  That turned out
bad due to list_concat modifying the original input lists.

In passing, make it more clear that the number of distinct values is
important to reduce tiebreaks during sorts.  Also, explain what the
n_preordered parameter means.

Backpatch-through: 15, where get_cheapest_group_keys_order was introduced.

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/55b4966365fa76bda275c409f3aefad43243f12c

Modified Files
--------------
src/backend/optimizer/path/pathkeys.c | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)



view thread (2+ messages)  latest in thread

Message-ID: <E1oaOrr-0016RT-HV@gemulon.postgresql.org>
Permalink:  ../E1oaOrr-0016RT-HV@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oaOrr-0016RT-HV@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: drowley@postgresql.org
  Subject: Re: pgsql: Fix misleading comment for get_cheapest_group_keys_order
  In-Reply-To: <E1oaOrr-0016RT-HV@gemulon.postgresql.org>
  References: <E1oaOrr-0016RT-HV@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox