-
-
Notifications
You must be signed in to change notification settings - Fork 520
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
is_in and is_not_in don't use CAST when comparing enums. #1527
Comments
Hey, I looked it up a bit and it seems to me that this issue actually belongs to the sea-query project. |
The bug actually comes from sea-orm, not sea-query (SeaQL/sea-query#667 (comment)) EDIT: I've also encountered the bug with |
Is there any update on this issue? |
No, consider using a workaround that I described in the text. |
@oganexon, it looks like ord operators were intentionally left out by the maintainers |
I can see that, but is there a valid reason for it? Comparing the values of the same enum is an SQL-supported operation that makes sense in many cases. For example, let's imagine a permission enum with |
That sounds like a potential footgun, it only makes sense if the enum is backed by an integer, but does |
It depends on whether the enum was defined as |
Fair point, may be we can add that |
Description
.is_in(...)
and.is_not_in(...)
don't use CAST when comparing enums.Steps to Reproduce
Expected Behavior
The same as with
.eq
,.ne
operators. Resulting query should look something like this.Actual Behavior
Generated query looks something like this
PgDatabaseError
is returned.Reproduces How Often
Always, I assume. But the bug was spoted when in subquery.
Workarounds
Well, it is possible to replace
.is_in
operator withThis thing works just fine. The generated query looks like this
Reproducible Example
I can do it by request, if anybody fails to reproduce the issue.
Versions
sea-orm v0.11.0
postgres
macos Ventura
The text was updated successfully, but these errors were encountered: