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-12 11:01:42 |
Message-ID: | bd7b4651-1c26-4d30-832b-f942fabcb145@postgrespro.ru |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi, Tom!
Thank you for working on this. I see you've fixed the patch and
committed it as a0b99fc1220. I tested it a bit and see some side effects
which may be unintentional.
1. SCHEMA lost object_name.
Before:
postgres=# create schema foo;
CREATE SCHEMA
postgres=# drop schema foo;
DROP SCHEMA
postgres=# select * from dropped_objects \gx
-[ RECORD 1 ]---+-------
n | 1
classid | 2615
objid | 16404
objsubid | 0
original | t
normal | f
is_temporary | f
object_type | schema
schema_name |
object_name | foo
object_identity | foo
address_names | {foo}
address_args | {}
After:
postgres=# select * from dropped_objects \gx
-[ RECORD 1 ]---+-------
n | 1
classid | 2615
objid | 16394
objsubid | 0
original | t
normal | f
is_temporary | f
object_type | schema
schema_name |
object_name |
object_identity | foo
address_names | {foo}
address_args | {}
2. DEFAULT VALUE now has schema_name and object_name.
Before:
postgres=# create temp table bar (a int default 0);
CREATE TABLE
postgres=# drop table bar;
DROP TABLE
postgres=# select * from dropped_objects where object_type =
'default value' \gx
-[ RECORD 1 ]---+------------------
n | 4
classid | 2604
objid | 16422
objsubid | 0
original | f
normal | f
is_temporary | f
object_type | default value
schema_name |
object_name |
object_identity | for pg_temp.bar.a
address_names | {pg_temp,bar,a}
address_args | {}
After:
postgres=# select * from dropped_objects where object_type =
'default value' \gx
-[ RECORD 1 ]---+------------------
n | 4
classid | 2604
objid | 16430
objsubid | 0
original | f
normal | f
is_temporary | t
object_type | default value
schema_name | pg_temp
object_name | bar
object_identity | for pg_temp.bar.a
address_names | {pg_temp,bar,a}
address_args | {}
This may be intentional, but doesn't quite match the description for
object_name in the docs:
Name of the object, if the combination of schema and name can be
used as a unique identifier for the object; otherwise NULL.
Also it doesn't match with the record for the column itself:
postgres=# create temp table bar (a int default 0);
CREATE TABLE
postgres=# alter table bar drop column a;
ALTER TABLE
postgres=# select * from dropped_objects \gx
-[ RECORD 1 ]---+------------------
n | 1
classid | 1259
objid | 16435
objsubid | 1
original | t
normal | f
is_temporary | t
object_type | table column
schema_name | pg_temp
object_name |
object_identity | pg_temp.bar.a
address_names | {pg_temp,bar,a}
address_args | {}
-[ RECORD 2 ]---+------------------
n | 2
classid | 2604
objid | 16438
objsubid | 0
original | f
normal | f
is_temporary | t
object_type | default value
schema_name | pg_temp
object_name | bar
object_identity | for pg_temp.bar.a
address_names | {pg_temp,bar,a}
address_args | {}
object_name is null for the table column, but not null for its default
value.
As for schema_name, I'm not sure whether it should be null or not.
Currently schema_name is null for triggers and policy objects, but that
may be accidental.
Best regards,
--
Sergey Shinderuk https://postgrespro.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Ashutosh Sharma | 2025-09-12 11:57:59 | Re: How can end users know the cause of LR slot sync delays? |
Previous Message | Amul Sul | 2025-09-12 10:55:28 | Re: pg_waldump: support decoding of WAL inside tarfile |