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: Á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-16 11:10:45
Message-ID: CAJ7c6TOfv+iAvD1o-TF_zL7mmETM=4v_65hOktqizM3LnF4hUQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

> I think it would be better to rewrite this code not to rely on SPI.

I will investigate this and start a new thread for better visibility.
This is an invasive change which requires broader discussion.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v3-0001-Remove-make_temptable_name_n.patch text/x-patch 3.4 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Zhijie Hou (Fujitsu) 2025-10-16 11:23:39 RE: Logical Replication of sequences
Previous Message jian he 2025-10-16 11:04:22 Re: [PATCH] pg_get_domain_ddl: DDL reconstruction function for CREATE DOMAIN statement