I've also encountered the bug with gte : `"operator does not exist: some_enum >= text".
Description
.is_in(...) and .is_not_in(...) don't use CAST when comparing enums.
gte as well and other operators I guess.
Steps to Reproduce
Create a table in Postgres, that has a field with custom type as enum.
Make a query to that table, having a condition of this enum field IN vector.
Expected Behavior
The same as with .eq, .ne operators. Resulting query should look something like this.
-- For .eq operator, it generates correctly
WHERE "table"."enum_field" = CAST($1 AS enum_type)
-- For .is_in operator, it generates a different query without CAST
WHERE "table"."enum_field" IN (CAST($1 AS enum_type), CAST($2 AS enum_type))
Actual Behavior
Generated query looks something like this
WHERE "table"."enum_field" IN ($1, $2)
PgDatabaseError is returned.
{severity: Error, code: "42883", message: "operator does not exist: enum_type <> text", ...}
Reproduces How Often
Always, I assume. But the bug was spoted when in subquery.
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.
Versions
sea-orm v0.11.0 postgres macos Ventura
Additional Information
cc @0xAndoroid