Re: [PATCH] Remove make_temptable_name_n()

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

Hi,

On Thu, Oct 16, 2025 at 8:11 PM Aleksander Alekseev
<aleksander(at)tigerdata(dot)com> wrote:
>
> Hi Álvaro,
>
> Thanks for your feedback.
>
> > Hmm, but instead of keeping the comment about why this is bogus, why not
> > just fix it and remove the comment? You could do something like
> >
> > nsp = get_namespace_name( .. );
> > diffname = psprintf("%s_%s_%d", nsp, RelationGetRelationName( .. ), 2);
> > tempname = quote_qualified_identifier(nsp, RelationGetRelationName( ... ));
> >
> > and then that should be fairly okay, I think, keeping in mind that both
> > the names involved are internally-generated short strings -- something
> > like pg_temp_19.pg_temp_28356_2.
>
> Sounds good to me. Here is the updated patch v3.

Thank you for the patch.

The v1 revision removed make_temptable_name_n and added psprintf,
which reduced the code size. However, the code size in v3 is almost
unchanged, so it's unclear how beneficial this change actually is.

Anyway, I have a minor comment about the patch.

+ char* nsp = get_namespace_name(RelationGetNamespace(tempRel));
+ char* temprelname = RelationGetRelationName(tempRel);
+ char* diffrelname = psprintf("%s_%d", temprelname, 2);

In PostgreSQL code, "char *xxx" seems to be more commonly used than "char* xxx".

--
Best regards,
Shinya Kato
NTT OSS Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David G. Johnston 2025-10-21 02:29:11 Re: Add \pset options for boolean value display
Previous Message Chao Li 2025-10-21 01:38:24 Re: Add \pset options for boolean value display