Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

269
Views
Postgres how to transfer all enums from foreign server

I have two databases that I want to be able to transfer data between, so I want to import a large schema from one database to the other, where there is allot of enums. So I ran into the problem descripted here SQL: error when creating a foreign table that has an enum column.

So I though I would like to something like "pg_dump enum" to get the enums and transfer them to the other database. But I can't such a command. Can you help me ?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can export the definitions with a query like this:

SELECT format(
          'CREATE TYPE %s AS ENUM (%s);',
          enumtypid::regtype,
          string_agg(quote_literal(enumlabel), ', ')
       )
FROM pg_enum
GROUP BY enumtypid;
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!