Re: support fix query_id for temp table

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Christoph Berg <myon(at)debian(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, ma lz <ma100(at)hotmail(dot)com>
Subject: Re: support fix query_id for temp table
Date: 2025-03-18 03:56:42
Message-ID: Z9ju-lB4r6fXcIKS@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Mon, Mar 17, 2025 at 10:38:36PM +0100, Christoph Berg wrote:
> Here's that patch with regression tests added. I would think changing
> this would be a big usability improvement for anyone using temp tables
> a lot.

Not the first time I am seeing this argument this month. It is the
second time.

+ /*
+ * If this is a temp table, jumble the name instead of the table oid.
+ */
+ if (expr->rtekind == RTE_RELATION && isAnyTempNamespace(get_rel_namespace(expr->relid)))
+ {
+ rel_name = get_rel_name(expr->relid);
+ AppendJumble(jstate, (const unsigned char *)rel_name, strlen(rel_name));
+ }
+ else
+ JUMBLE_FIELD(relid);

This is OK on its own, still feels a bit incomplete, as the relid also
includes an assumption about the namespace. I would suggested to add
a hardcoded "pg_temp" here, to keep track of this assumption, at
least.

typedef struct RangeTblEntry
{
- pg_node_attr(custom_read_write)
+ pg_node_attr(custom_read_write, custom_query_jumble)

This structure still includes some query_jumble_ignore, which are not
required once custom_query_jumble is added.

We had better document at the top of RangeTblEntry why we are using a
custom function.
--
Michael

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ron Johnson 2025-03-18 10:59:22 Re: Cannot pg_dump_all anymore...
Previous Message Christoph Berg 2025-03-17 21:38:36 Re: support fix query_id for temp table

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2025-03-18 04:02:09 Re: Update Unicode data to Unicode 16.0.0
Previous Message jian he 2025-03-18 03:55:44 Re: Change COPY ... ON_ERROR ignore to ON_ERROR ignore_row