Re: BUG #19417: '\dD' fails to list user-defined domains that shadow built-in type names (e.g., 'numeric')

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: zhangyc0706(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #19417: '\dD' fails to list user-defined domains that shadow built-in type names (e.g., 'numeric')
Date: 2026-02-26 16:18:14
Message-ID: 644541.1772122694@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> I created a domain object named `numeric` using the following SQL:
> `CREATE DOMAIN numeric AS NUMERIC(12,2) DEFAULT 0 CHECK (VALUE >= 0);`
> After executing this SQL, it indicated that the domain was created
> successfully.
> However, when I executed `\dD` in psql, I found that the domain I just
> created could not be displayed.

This is expected, because that domain will be behind the built-in
"numeric" type: pg_catalog.numeric comes ahead of public.numeric
in the default search_path. As the psql documentation explains:

Whenever the pattern parameter is omitted completely, the \d
commands display all objects that are visible in the current
schema search path — this is equivalent to using * as the
pattern. (An object is said to be visible if its containing schema
is in the search path and no object of the same kind and name
appears earlier in the search path. This is equivalent to the
statement that the object can be referenced by name without
explicit schema qualification.) To see all objects in the database
regardless of visibility, use *.* as the pattern.

So you'd see the domain if you wrote

\dD *.*

or

\dD public.*

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2026-02-26 18:27:10 Re: pg_get_viewdef() produces non-round-trippable SQL for views with USING join on mismatched integer types
Previous Message David G. Johnston 2026-02-26 16:12:41 Re: BUG #19417: '\dD' fails to list user-defined domains that shadow built-in type names (e.g., 'numeric')