-
Notifications
You must be signed in to change notification settings - Fork 24
Open
Description
I have an enum with a derived DbCodec. However, when using it in something like Repo.insert, you will end up getting the following (on Postgres, at least):
com.augustnagro.magnum.SqlException: Error executing query:
INSERT INTO my_table (enum_name) VALUES (?)
With message:
org.postgresql.util.PSQLException: ERROR: column "enum_name" is of type my_enum but expression is of type character varying
Hint: You will need to rewrite or cast the expression.
Position: 79
The fix, is that when you use an enum-based field in the SQL, you need to write enum_name::text when using queries on it, and for insertions, the ? should be ?::my_enum. I guess the Repo generation needs to be aware of splicing in enum values?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels