Re: A tidyup of pathkeys.c - Mailing list pgsql-hackers

From Richard Guo
Subject Re: A tidyup of pathkeys.c
Date
Msg-id CAMbWs4-U66V9F-pz2zEngoLP=UHU4G7LMuFJh_kfdtoRrekB2g@mail.gmail.com
Whole thread Raw
In response to A tidyup of pathkeys.c  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: A tidyup of pathkeys.c
List pgsql-hackers
On Tue, Oct 14, 2025 at 3:03 PM David Rowley <dgrowleyml@gmail.com> wrote:
> Here's a list of what I've changed:
>
> 1. Add count_common_leading_pathkeys_ordered() function to check for
> leading common pathkeys and use that for sort_pathkeys,
> window_pathkeys and window_pathkeys.
> 2. Add count_common_leading_pathkeys_unordered() to check for leading
> common pathkeys that exist in any portion of the other list of
> pathkeys. Use this for group_pathkeys and distinct_pathkeys.
> 3. Add some short-circuiting to truncate_useless_pathkeys() as there's
> no point in trying to trim down the list when some other operation has
> already figured out that it needs all of the pathkeys.
> 4. Remove the stray " if (root->group_pathkeys != NIL) return true"
> from has_useful_pathkeys().

+1.  I think this is a nice tidy-up.

FWIW, I complained about the stray check in has_useful_pathkeys() in
[1] last week, but you were quicker than me in making the code change
to remove it.

[1] https://postgr.es/m/CAMbWs4_zW5QU=Zk32s17p8qWY+ga-3ZUTons+y+Wopguiopm4A@mail.gmail.com

- Richard



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Executing pg_createsubscriber with a non-compatible control file
Next
From: John Naylor
Date:
Subject: Re: get rid of RM_HEAP2_ID