Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgres: CAST($2 AS CaseSensitiveEnumType) enum type must be enquoted #725

Open
niklaskorz opened this issue Dec 18, 2023 · 0 comments
Open

Comments

@niklaskorz
Copy link

niklaskorz commented Dec 18, 2023

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

  1. Have a model field with a case-sensitive enum type name
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant