Re: [PATCH] Remove make_temptable_name_n() - Mailing list pgsql-hackers

From Shinya Kato
Subject Re: [PATCH] Remove make_temptable_name_n()
Date
Msg-id CAOzEurRVi_2qVz9pog4kD2vDVigMu25UcKmE8xAhE19sLVK3QA@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Remove make_temptable_name_n()  (Aleksander Alekseev <aleksander@tigerdata.com>)
Responses Re: [PATCH] Remove make_temptable_name_n()
List pgsql-hackers
Hi,

On Thu, Oct 16, 2025 at 8:11 PM Aleksander Alekseev
<aleksander@tigerdata.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



pgsql-hackers by date:

Previous
From: Chao Li
Date:
Subject: Re: Add \pset options for boolean value display
Next
From: "David G. Johnston"
Date:
Subject: Re: Add \pset options for boolean value display