Closed
Description
Description
When a model contains a field with a case-sensitive enum type name, querying the table crashes because the type name is not enquoted in the CAST
.
Steps to Reproduce
- Have a model field with a case-sensitive enum type name
- Query the model for rows with a specific value for this enum field
Expected Behavior
The query should not crash.
Actual Behavior
2023-12-18T11:15:22.411880Z INFO JobScheduler::recover_jobs: sqlx::query: summary="SELECT \"KjuJob\".\"id\", \"KjuJob\".\"type\", \"KjuJob\".\"data\", …" db.statement="\n\nSELECT\n \"KjuJob\".\"id\",\n \"KjuJob\".\"type\",\n \"KjuJob\".\"data\",\n CAST(\"KjuJob\".\"state\" AS text),\n \"KjuJob\".\"created\",\n \"KjuJob\".\"updated\"\nFROM\n \"KjuJob\"\nWHERE\n \"KjuJob\".\"state\" = CAST($1 AS KjuJobState)\n OR \"KjuJob\".\"state\" = CAST($2 AS KjuJobState)\n" rows_affected=0 rows_returned=0 elapsed=19.019766ms
Error: Query Error: error returned from database: type "kjujobstate" does not exist
All type names in this query are enquoted and thus case-sensitive, except in \"KjuJob\".\"state\" = CAST($2 AS KjuJobState)
.
Reproduces How Often
Every time
Versions
0.30.0
Additional Information
Metadata
Metadata
Assignees
Labels
No labels