Re: Skip temporary table schema name from explain-verbose output.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Amul Sul <sulamul(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Skip temporary table schema name from explain-verbose output.
Date: 2021-07-26 17:33:29
Message-ID: 171422.1627320809@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Jul 26, 2021 at 12:49 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I can't really see any situation in which it's important
>> to report the exact schema name of our own temp schema.

> It would actually be nice if there were some easy way of getting that
> for the rare situations in which there are problems.

I experimented with pushing the behavior into get_namespace_name,
and immediately ran into problems, for example

--- /home/postgres/pgsql/src/test/regress/expected/jsonb.out 2021-03-01 16:32
:13.348655633 -0500
+++ /home/postgres/pgsql/src/test/regress/results/jsonb.out 2021-07-26 13:10
:53.523540855 -0400
@@ -320,11 +320,9 @@
where tablename = 'rows' and
schemaname = pg_my_temp_schema()::regnamespace::text
order by 1;
- attname | histogram_bounds
----------+--------------------------
- x | [1, 2, 3]
- y | ["txt1", "txt2", "txt3"]
-(2 rows)
+ attname | histogram_bounds
+---------+------------------
+(0 rows)

-- to_jsonb, timestamps
select to_jsonb(timestamp '2014-05-28 12:22:35.614298');

What's happening here is that regnamespace_out is returning
'pg_temp' which doesn't match any name visible in pg_namespace.
So that would pretty clearly break user queries as well as
our own tests. I'm afraid that the wholesale behavior change
I was imagining isn't going to work. Probably we'd better stick
to doing something close to the v2 patch I posted.

I'm still suspicious of that logic in event_trigger.c, though.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2021-07-26 17:35:41 Re: Have I found an interval arithmetic bug?
Previous Message Bossart, Nathan 2021-07-26 17:33:03 Re: Use WaitLatch for {pre, post}_auth_delay instead of pg_usleep