query_id: jumble names of temp tables for better pg_stat_statement UX

From: Christoph Berg <myon(at)debian(dot)org>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, ma lz <ma100(at)hotmail(dot)com>
Subject: query_id: jumble names of temp tables for better pg_stat_statement UX
Date: 2025-03-18 16:51:54
Message-ID: Z9mkqplmUpQ4xG52@msg.df7cb.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Re: Michael Paquier
> 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.

I had thought about it, but figured that integers and strings are
already separate namespaces, so hashing them shouldn't have any
conflicts. But it's more clear to do that, so added in the new
version:

AppendJumble(jstate, (const unsigned char *)"pg_temp", sizeof("pg_temp"));
AppendJumble(jstate, (const unsigned char *)rel_name, strlen(rel_name));

> 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.

I would tend to keep them for documentation purposes. (The other
custom_query_jumble functions have a much more explicit structure so
there it is clear which fields are supposed to be jumbled.)

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

I added a short comment just above custom_query_jumble.

Christoph

Attachment Content-Type Size
v2-0001-Jumble-temp-tables-by-name.patch text/x-diff 5.7 KB

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2025-03-18 18:41:39 Re: After upgrading libpq, the same function(PQftype) call returns a different OID
Previous Message Evgeniy Ratkov 2025-03-18 13:27:48 Re: BUG #18575: Sometimes pg_rewind mistakenly assumes that nothing needs to be done.

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacob Champion 2025-03-18 16:53:51 Re: dblink: Add SCRAM pass-through authentication
Previous Message Robert Haas 2025-03-18 16:43:18 Re: making EXPLAIN extensible