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

Attachment: signature.asc
Description: PGP signature

Reply via email to