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
I think, this version is more correct and easier to understand (regarding case-sensitivity, [] handling, etc). The summary is in the changelog, as always
But now I'm stuck with this failing ExprTrait::as_enum doctest. I've read this explanation of AsEnum and I understand the need to separate quoted (case-sensitive) and unquoted (case-insensitive) casts, but I still don't understand why as_enum needs to do a cast only on Postgres and do nothing on MySQL and SQLite. This behavior is undocumented, seems very weird, and requires that special AsEnum node which I tried to remove.
Is this something that SeaORM needs? Perhaps, SeaORM itself should apply this DB-specific logic? I find it weird that I can explicitly call my_val.as_enum(my_type) (a seemingly low-level query builder method) and get no cast at all, depending on the database.
To further explain, in Postgres a enum is a (user-defined) type that's created by the CREATE TYPE statement.
MySQL is more relaxed, it's basically a string with some constraints.
In SQLite it is just a string.
The problem is when doing inserts for example, we can do INSERT INTO my_table VALUES ('my_enum_variant') in MySQL / SQLite, but has to cast it explicitly in Postgres INSERT INTO my_table VALUES (CAST 'my_enum_variant' as "my_enum").
The problem in SeaORM is that the frontend (query building stage) doesn't know about the backend yet. It's only known when we call exec, and I'd rather not walk the AST again and tweak the nodes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #954.
I think, this version is more correct and easier to understand (regarding case-sensitivity,
[]handling, etc). The summary is in the changelog, as always