How to store rich enum type (variants hold data) in Postgres? #2124
Unanswered
felix-andreas
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Did you find a solution? I had the same problem |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! We would like store an enum type where the variants hold data in our Postgres database. For example:
For now we created three tables
animals
,cats
, anddogs
. But this makes our queries very cumbersome:Furthermore, this probably scales very bad. Is somebody aware of a better alternative to represent sum type (enums) in Postgres. Or, is there a way to automate this approach with
sqlx
? Any help is appreciated! Thanks!Beta Was this translation helpful? Give feedback.
All reactions