Re: Error with DEFAULT VALUE in temp table
Sergey Shinderuk <s.shinderuk@postgrespro.ru>
From: Sergey Shinderuk <s.shinderuk@postgrespro.ru>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Антуан Виолин <violin.antuan@gmail.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2025-09-12T12:43:09Z
Lists: pgsql-hackers
On 12.09.2025 14:01, Sergey Shinderuk wrote:
> 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.
Perhaps "default value" should be like "table constraint", which have
schema_name and null object_name.
postgres=# create temp table bar (a int not null 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 | 16445
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 | 16448
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 | {}
-[ RECORD 3 ]---+------------------------------
n | 3
classid | 2606
objid | 16449
objsubid | 0
original | f
normal | f
is_temporary | t
object_type | table constraint
schema_name | pg_temp
object_name |
object_identity | bar_a_not_null on pg_temp.bar
address_names | {pg_temp,bar,bar_a_not_null}
address_args | {}
Best regards,
--
Sergey Shinderuk https://postgrespro.com/
Commits
-
Fix oversights in pg_event_trigger_dropped_objects() fixes.
- ef81db9697a0 18.0 landed
- f14ea34d6e56 19 (unreleased) landed
- f6c8e7824c5d 16.11 landed
- a220e40d1106 17.7 landed
- 33e49ee014b0 15.15 landed
-
Report the correct is_temporary flag for column defaults.
- a0b99fc12203 19 (unreleased) landed
- c0c8ee23c896 17.7 landed
- 8856f1acc97b 16.11 landed
- 451373dc5c41 15.15 landed
- 3c02c46521b0 18.0 landed