public inbox for [email protected]  
help / color / mirror / Atom feed
BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema  (PG 18.3)
3+ messages / 3 participants
[nested] [flat]

* BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema  (PG 18.3)
@ 2026-03-30 03:12  PG Bug reporting form <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: PG Bug reporting form @ 2026-03-30 03:12 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

The following bug has been logged on the website:

Bug reference:      19446
Logged by:          Xianghang Zheng
Email address:      [email protected]
PostgreSQL version: 18.3
Operating system:   Linux x86_64
Description:        

1. PostgreSQL Version
PostgreSQL 18.3 (x86_64)
2. Operating System
Linux x86_64
3. Problem Description
When a column uses a domain with DEFAULT value, all system catalogs fail to
reflect the default:
- pg_attribute.atthasdef = false
- No entries in pg_attrdef
- information_schema.columns.column_default is empty
But the default value works correctly at runtime.
This is a metadata bug.
4. Steps to Reproduce
CREATE DOMAIN info_domain AS int DEFAULT 100;
CREATE TABLE t (col info_domain);
SELECT attname, atthasdef
FROM pg_attribute
WHERE attrelid = 't'::regclass AND attnum > 0;
SELECT * FROM pg_attrdef WHERE adrelid = 't'::regclass;
SELECT column_name, column_default
FROM information_schema.columns
WHERE table_name = 't' AND column_name = 'col';
INSERT INTO t DEFAULT VALUES;
SELECT * FROM t;
5. Actual Result
- atthasdef = f
- pg_attrdef returns empty
- column_default is empty
- But the default value 100 works
6. Expected Result
System catalogs should show the domain's DEFAULT correctly.
7. Test Output
postgres=# CREATE DOMAIN info_domain AS int DEFAULT 100;
CREATE DOMAIN
postgres=# CREATE TABLE t (col info_domain);
CREATE TABLE
postgres=# SELECT attname, atthasdef FROM pg_attribute WHERE attrelid =
't'::regclass AND attnum > 0;
 attname | atthasdef
---------+-----------
 col     | f
(1 row)
postgres=# SELECT * FROM pg_attrdef WHERE adrelid = 't'::regclass;
 oid | adrelid | adnum | adbin
-----+---------+-------+-------
(0 rows)
postgres=# SELECT column_name, column_default FROM
information_schema.columns WHERE table_name = 't' AND column_name = 'col';
 column_name | column_default
-------------+----------------
 col         |
(1 row)
postgres=# INSERT INTO t DEFAULT VALUES;
INSERT 0 1
postgres=# SELECT * FROM t;
 col
-----
 100
(1 row)








^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema (PG 18.3)
@ 2026-03-30 15:00  Junwang Zhao <[email protected]>
  parent: PG Bug reporting form <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Junwang Zhao @ 2026-03-30 15:00 UTC (permalink / raw)
  To: [email protected]; [email protected]

On Mon, Mar 30, 2026 at 7:52 PM PG Bug reporting form
<[email protected]> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference:      19446
> Logged by:          Xianghang Zheng
> Email address:      [email protected]
> PostgreSQL version: 18.3
> Operating system:   Linux x86_64
> Description:
>
> 1. PostgreSQL Version
> PostgreSQL 18.3 (x86_64)
> 2. Operating System
> Linux x86_64
> 3. Problem Description
> When a column uses a domain with DEFAULT value, all system catalogs fail to
> reflect the default:
> - pg_attribute.atthasdef = false
> - No entries in pg_attrdef
> - information_schema.columns.column_default is empty
> But the default value works correctly at runtime.
> This is a metadata bug.
> 4. Steps to Reproduce
> CREATE DOMAIN info_domain AS int DEFAULT 100;
> CREATE TABLE t (col info_domain);
> SELECT attname, atthasdef
> FROM pg_attribute
> WHERE attrelid = 't'::regclass AND attnum > 0;
> SELECT * FROM pg_attrdef WHERE adrelid = 't'::regclass;
> SELECT column_name, column_default
> FROM information_schema.columns
> WHERE table_name = 't' AND column_name = 'col';
> INSERT INTO t DEFAULT VALUES;
> SELECT * FROM t;
> 5. Actual Result
> - atthasdef = f
> - pg_attrdef returns empty
> - column_default is empty
> - But the default value 100 works
> 6. Expected Result
> System catalogs should show the domain's DEFAULT correctly.
> 7. Test Output
> postgres=# CREATE DOMAIN info_domain AS int DEFAULT 100;
> CREATE DOMAIN
> postgres=# CREATE TABLE t (col info_domain);
> CREATE TABLE
> postgres=# SELECT attname, atthasdef FROM pg_attribute WHERE attrelid =
> 't'::regclass AND attnum > 0;
>  attname | atthasdef
> ---------+-----------
>  col     | f
> (1 row)
> postgres=# SELECT * FROM pg_attrdef WHERE adrelid = 't'::regclass;
>  oid | adrelid | adnum | adbin
> -----+---------+-------+-------
> (0 rows)
> postgres=# SELECT column_name, column_default FROM
> information_schema.columns WHERE table_name = 't' AND column_name = 'col';
>  column_name | column_default
> -------------+----------------
>  col         |
> (1 row)
> postgres=# INSERT INTO t DEFAULT VALUES;
> INSERT 0 1
> postgres=# SELECT * FROM t;
>  col
> -----
>  100
> (1 row)
>
>
>
>

Same as your report of bug #19445, this should be by design.


-- 
Regards
Junwang Zhao






^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema (PG 18.3)
@ 2026-03-30 18:51  Tom Lane <[email protected]>
  parent: PG Bug reporting form <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Tom Lane @ 2026-03-30 18:51 UTC (permalink / raw)
  To: [email protected]; +Cc: [email protected]

PG Bug reporting form <[email protected]> writes:
> When a column uses a domain with DEFAULT value, all system catalogs fail to
> reflect the default:
> - pg_attribute.atthasdef = false
> - No entries in pg_attrdef
> - information_schema.columns.column_default is empty
> But the default value works correctly at runtime.
> This is a metadata bug.

This is a duplicate of #19445, and is no more valid than that is.
Please stop harassing us with poorly-researched bug reports.

			regards, tom lane






^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-03-30 18:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-03-30 03:12 BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema  (PG 18.3) PG Bug reporting form <[email protected]>
2026-03-30 15:00 ` Re: BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema (PG 18.3) Junwang Zhao <[email protected]>
2026-03-30 18:51 ` Re: BUG #19446: Domain DEFAULT not reflected in system catalogs and information_schema (PG 18.3) Tom Lane <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox