Re: [PATCH] Remove make_temptable_name_n()

From: Aleksander Alekseev <aleksander(at)tigerdata(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Shinya Kato <shinya11(dot)kato(at)gmail(dot)com>, Álvaro Herrera <alvherre(at)kurilemu(dot)de>
Subject: Re: [PATCH] Remove make_temptable_name_n()
Date: 2025-10-22 13:20:01
Message-ID: CAJ7c6TMK8DdJyGvo3PW_a+WTjTRSVaeiXDQXnO_GewB0PGNRnQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Nathan,

> > + {
> > + char *nsp = get_namespace_name(RelationGetNamespace(tempRel));
> > + char *temprelname = RelationGetRelationName(tempRel);
> > + char *diffrelname = psprintf("%s_%d", temprelname, 2);
>
> I assume the intent of the extra set of curly brackets is to keep the
> declarations of these variables close to where they are used. In this
> case, the top of the function is only a few lines up, so IMHO we should
> declare them there and save a level of indentation.
>
> > + pfree(diffrelname);
> > + if (nsp)
> > + pfree(nsp);
>
> Any reason to be so careful about freeing these? We ordinarily let the
> memory context take care of freeing, and refresh_by_match_merge() looks no
> different.

These were just a matter of my personal preferences. I have no strong
opinion on this. Here is the updated patch.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v5-0001-Remove-make_temptable_name_n.patch text/x-patch 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Akshay Joshi 2025-10-22 13:21:50 Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement
Previous Message Akshay Joshi 2025-10-22 13:19:10 Re: [PATCH] Add pg_get_policy_ddl() function to reconstruct CREATE POLICY statement