Re: Error with DEFAULT VALUE in temp table

From: Sergey Shinderuk <s(dot)shinderuk(at)postgrespro(dot)ru>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Антуан Виолин <violin(dot)antuan(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error with DEFAULT VALUE in temp table
Date: 2025-09-13 06:08:21
Message-ID: 6db29fb1-b3ac-42c3-b86a-3f4de124bece@postgrespro.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 13.09.2025 00:19, Tom Lane wrote:
> Fixed (and tested) in the attached.

Great! Thank you.

> So that "else" action was unreachable, and the code failed
> to set "istemp" true for its own temp schema.

As for dropping my own temp schema, it's still a bit inconsistent (as it
was before):

postgres=# select pg_my_temp_schema()::regnamespace;
pg_my_temp_schema
-------------------
pg_temp_0
(1 row)
postgres=# drop schema pg_temp_0;
DROP SCHEMA

postgres=# select * from dropped_objects where object_type =
'schema' and is_temporary \gx
-[ RECORD 1 ]---+----------
n | 7
classid | 2615
objid | 16398
objsubid | 0
original | t
normal | f
is_temporary | t
object_type | schema
schema_name |
object_name | pg_temp_0
object_identity | pg_temp
address_names | {pg_temp}
address_args | {}

object_identity is pg_temp, but object_name is pg_temp_0. But maybe
that's okay. Anyway, I don't think that dropping my own temp schema
makes sense.

Also I noticed that schema_name for temp functions doesn't match with
object_identity (pg_temp vs pg_temp_1):

postgres=# create function pg_temp.bar(int) returns int as 'select
$1' language sql;
CREATE FUNCTION
postgres=# drop function pg_temp.bar(int);
DROP FUNCTION

postgres=# select * from dropped_objects where object_type =
'function' and is_temporary \gx
-[ RECORD 1 ]---+-----------------------
n | 8
classid | 1255
objid | 16412
objsubid | 0
original | t
normal | f
is_temporary | t
object_type | function
schema_name | pg_temp
object_name |
object_identity | pg_temp_1.bar(integer)
address_names | {pg_temp,bar}
address_args | {integer}

There should be a call to get_namespace_name_or_temp somewhere, I guess.

If you say this should be fixed, I can come up with a patch later. But
maybe it's trivial.

Thanks again!

--
Sergey Shinderuk https://postgrespro.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2025-09-13 07:15:10 Re: How can end users know the cause of LR slot sync delays?
Previous Message Noah Misch 2025-09-13 02:02:33 Re: pg_dump does not dump domain not-null constraint's comments