Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drop all data types in Postgres

Tags:

postgresql

Is there a way to drop all the data types listed by \dT+.

I know you can drop types individually via DROP TYPE command, but I have a lot of types and it's painstaking to drop them all individually.

like image 767
user886596 Avatar asked Sep 06 '25 19:09

user886596


1 Answers

Following the directions suggested by user Schwern, I used psql -E and got this to work:

  1. Run SELECT typname, typnamespace from pg_type;
  2. Figure out what typnamespace your types are associated with
  3. DELETE FROM pg_type WHERE typnamespace=${your_typnamespace}
like image 92
user886596 Avatar answered Sep 11 '25 04:09

user886596