How to list custom types using Postgres information_schema

后端 未结 7 1494
遥遥无期
遥遥无期 2020-12-28 12:40

I am trying to find the equivalent SQL of \\dT using the information_schema and can\'t seem to find anything. Does such a thing exist?

Example: If I add the followi

7条回答
  •  孤独总比滥情好
    2020-12-28 13:09

    This is a simple way to list all the enum defined types in the current database. The query result returns two columns, the first show the name of every enum types, the second show the name of every value for each enum type:

     SELECT pg_type.typname AS enumtype, 
         pg_enum.enumlabel AS enumlabel
     FROM pg_type 
     JOIN pg_enum 
         ON pg_enum.enumtypid = pg_type.oid;
    

提交回复
热议问题