Re: Listing only the user defined types (with owners) - Mailing list pgsql-general

From Tom Lane
Subject Re: Listing only the user defined types (with owners)
Date
Msg-id 2204951.1714659329@sss.pgh.pa.us
Whole thread Raw
In response to Re: Listing only the user defined types (with owners)  (Thom Brown <thom@linux.com>)
List pgsql-general
Thom Brown <thom@linux.com> writes:
> On Thu, 2 May 2024 at 12:40, Durumdara <durumdara@gmail.com> wrote:
>> Do you have a working Query which lists the user defined types with the
>> owners?

> You can always cheat and copy what psql does when you tell it to list all
> user types with extended output (\dt+):

If you want to look at what SQL psql issues for a \d-type command,
you don't even need to look at the server log.  Just start psql with
the -E (--echo-hidden) switch.

$ psql -E
psql (17devel)
Type "help" for help.

postgres=# \dT+
/******** QUERY *********/
SELECT n.nspname as "Schema",
  pg_catalog.format_type(t.oid, NULL) AS "Name",
  t.typname AS "Internal name",
  CASE WHEN t.typrelid != 0
      THEN CAST('tuple' AS pg_catalog.text)
    WHEN t.typlen < 0
      THEN CAST('var' AS pg_catalog.text)
    ELSE CAST(t.typlen AS pg_catalog.text)
  END AS "Size",
... etc etc ...

            regards, tom lane



pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Prevent users from executing pg_dump against tables
Next
From: Adrian Klaver
Date:
Subject: Re: How to interpret 'depends on' errors in pg_restore?