Re: Missing list_free in publicationcmds.c:OpenTableList - Mailing list pgsql-hackers

From Peter Smith
Subject Re: Missing list_free in publicationcmds.c:OpenTableList
Date
Msg-id CAHut+Puc4r2E1E8ZExgjHW=0q=Zj-oiA-i+huF+hp+baJp+eXQ@mail.gmail.com
Whole thread
In response to Missing list_free in publicationcmds.c:OpenTableList  (Peter Smith <smithpb2250@gmail.com>)
Responses Re: [PATCH] Add pg_get_table_ddl() to reconstruct CREATE TABLE statements
List pgsql-hackers
On Tue, Aug 11, 2026 at 8:20 AM surya poondla <suryapoondla4@gmail.com> wrote:
>
> Hi Peter,
>
> +1 for v2, I confirmed the premise: OpenTableList() is only reached from CreatePublication() and
AlterPublicationTables(),i.e. once 
> per DDL statement, with the lists allocated in the command's context.
>

Thanks for your review!

> Can you add a comment before the return something like
>        /*
>          * relids, relids_with_rf and relids_with_collist are deliberately not
>          * freed here.  This function runs at most once per DDL command, the
>          * surrounding command-lifetime memory context frees them later.
>          */
> So future readers will not think of it as a bug.
> This is only a suggestion, feel free to skip it if you'd rather keep the patch minimal.
>

Fair enough. TBH I'm not sure if comments like this are usual
practice, but I did find a couple of similar examples, so I've added a
comment to v3 as suggested, and a committer can decide to keep it or
not.

======
Kind Regards,
Peter Smith.
Fujitsu Australia

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Introduce psystem() to replace system()
Next
From: Michael Paquier
Date:
Subject: Re: [PATCH] Fix TOCTOU races in recovery/t/020_archive_status.pl archive checks