You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My understanding is that the ToSql macro should take the value defined in the postgres name and use that in the SQL statement, which means the spaces defined in the name should be preserved. However, I'm receiving an error from Postgres that the type is incorrect.
After digging further, it appears that the issue is that there was a value unexpectedly in the Postgres Type definition (i.e. Break Free) that was NOT defined in the enum of BookablePersonEventType. It seems like there is some sort of validation to ensure that the type defined in Rust matches the type defined in Postgres (which is a nice feature). The reasoning for the failure just wasn't clear in this case.
Would there be any way to improve an error message or documentation on the exact matching of the definitions? Again, that feature makes sense and is nice to include, but I just wasn't aware of that validation\enforcement.
burkematthew
changed the title
Enum values defined with spaces are erroring
Unclear error message when enum definition is inconsistent with the Postgres Type definition
Jun 7, 2023
I have an enum defined as below:
The type
bookable_person_event_type
is defined in Postgres as such:However, when attempting an INSERT mutation, the enum value is failing to convert to the value defined in the postgres name macro.
Code to handle the mutation:
My understanding is that the
ToSql
macro should take the value defined in the postgres name and use that in the SQL statement, which means the spaces defined in the name should be preserved. However, I'm receiving an error from Postgres that the type is incorrect.This behavior seems to have changed recently, though I can't point to why\where. Any help\insight is greatly appreciated!
The text was updated successfully, but these errors were encountered: