Creating an enum field in UI Bakery Postgres

Would anyone be able to tell me how I can set up an enum-type field when creating a postgres table (using the integrated postgres offering)?

When I try to do so, I get a toast saying Create table error: type "enum" does not exist. I haven’t be able to find any documentation on how to define my enum values.

Thank you!

1 Like

Though it would still be nice to know how to do this, I ended up switching to an externally hosted Postgres database.

Hey @blazix,

Thanks for highlighting it! And it seems like enum creation was not implemented in our built-in DB editor :see_no_evil:
Sorry for the inconveniences! I’ve created an internal feature request regarding enum creation.

Please use such a query as a workaround (via Data Sources → Query Runner):

CREATE TYPE difficulty AS ENUM('easy', 'medium', 'hard');
ALTER TABLE public.sample_table
ADD COLUMN difficulty difficulty;

Don’t forget to press “Sync” button after query run.

1 Like

No problem @spherebread! Thank you for the workaround! I hadn’t realised that I was able to run SQL directly on the built-in DB!

1 Like