Check if a user-defined type already exists in PostgreSQL

后端 未结 10 1530
离开以前
离开以前 2020-12-29 01:43

Say I have created some user-defined types in the DB,

i.e. CREATE TYPE abc ...

Is it then possible to determine if the user-defined type exists

10条回答
  •  醉梦人生
    2020-12-29 02:45

    You can look in the pg_type table:

    select exists (select 1 from pg_type where typname = 'abc');
    

    If that is true then abc exists.

提交回复
热议问题