pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix misleading comment for get_cheapest_group_keys_order 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix misleading comment for get_cheapest_group_keys_order @ 2022-09-19 22:03 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: David Rowley @ 2022-09-19 22:03 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix misleading comment for get_cheapest_group_keys_order @ 2022-09-19 22:04 David Rowley <drowley@postgresql.org> 0 siblings, 0 replies; 2+ messages in thread From: David Rowley @ 2022-09-19 22:04 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1ec2d0bc68db9ddffeeaa7f8a9f79ac2620d52e1 Modified Files -------------- src/backend/optimizer/path/pathkeys.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-09-19 22:04 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-09-19 22:03 pgsql: Fix misleading comment for get_cheapest_group_keys_order David Rowley <drowley@postgresql.org> 2022-09-19 22:04 pgsql: Fix misleading comment for get_cheapest_group_keys_order David Rowley <drowley@postgresql.org>
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