Re: Handle infinite recursion in logical replication setup - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: Handle infinite recursion in logical replication setup
Date
Msg-id CAA4eK1LwjG--SUmSqFwXm80me+4A7h=ut4RviG5gRRuFZZr7_A@mail.gmail.com
Whole thread Raw
In response to RE: Handle infinite recursion in logical replication setup  ("shiy.fnst@fujitsu.com" <shiy.fnst@fujitsu.com>)
List pgsql-hackers
On Wed, Sep 7, 2022 at 1:09 PM shiy.fnst@fujitsu.com
<shiy.fnst@fujitsu.com> wrote:
>
> On Wed, Sep 7, 2022 12:23 PM vignesh C <vignesh21@gmail.com> wrote:
> >
> >
> > Thanks for the comments, the attached v47 patch has the changes for the
> > same.
> >
>
> Thanks for updating the patch.
>
> Here is a comment.
>
> +       for (i = 0; i < subrel_count; i++)
> +       {
> +               Oid                     relid = subrel_local_oids[i];
> +               char       *schemaname = get_namespace_name(get_rel_namespace(relid));
> +               char       *tablename = get_rel_name(relid);
> +
> +               appendStringInfo(&cmd, "AND NOT (N.nspname = '%s' AND C.relname = '%s')\n",
> +                                                schemaname, tablename);
> +       }
>
> Would it be better to add "pfree(schemaname)" and "pfree(tablename)" after
> calling appendStringInfo()?
>

No, I don't think we need to do retail pfree of each and every
allocation as these allocations are made in the portal context which
will be freed by the command end.

-- 
With Regards,
Amit Kapila.



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: Add tracking of backend memory allocated to pg_stat_activity
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Add tracking of backend memory allocated to pg_stat_activity