-
-
Notifications
You must be signed in to change notification settings - Fork 231
Allow qualified type names in cast_as_quoted
#922
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
Conversation
|
Hold up. Why did I rename the parameter to I need to implement and merge Don't merge this PR as is. |
|
I see your point. it works but is kind of wrong in a type system sense. also I think this parameter can appear in other places as well, e.g. ALTER TYPE, so may be worth to have a |
Extracted the `foo.bar.baz` qualification logic that was duplicated across several variants of `ColumnRef` and `TableRef`. I need this to implement `schema.type`: #827, #922 I'll also need this to implement `schema.function` later: #795 (reply in thread) There are also immediate benefits. IMO, `ColumnRef` and `TableRef` (and their pattern-matching) look considerably cleaner now. The `database.` prefix is guaranteed to be supported everywhere where it may be needed. The detailed changelog is in the diff. I fully preserved (and documented) the existing codegen behavior, as evidenced by unchanged output in tests. If this documented behavior looks suspicious (it kinda does to me), let's fix that later in a separate PR. Here, the only changes in tests are the refactoring that's needed for the new variants to compile. This is a relatively big breaking change for those users who dig within the internals of `ColumnRef`, `TableRef`, and `SchemaTable`. But that's very low-level and should be rare. My work project never does that, despite depending on SeaORM/SeaQuery/SQLx very closely and frequently getting generic or low-level. ## PR Info - Dependents: - #922
d73454a to
427a2fc
Compare
IntoColumnRef in cast_as_quotedcast_as_quoted
|
Rebased on top of #953 as an experiment. The first commit comes from that branch. The second commit is the actual content of this PR. The
|
|
I've just googled type names in Posgtres. Boy, is it complicated even without I think, we need to agree what exactly a |
I agree with this.
As I mentioned here: #926 |
|
Yeah it's complicated I don't think a universal solution is easy. I would just stick with the low hanging fruit for now, which basically is the draft PR you have. for context,
this explains the special handling above. so it's not just enums, but any custom types. SeaORM currently only supports enums. https://github.com/SeaQL/sea-query/blob/master/src/expr.rs#L189 |
|
Ok, then I'll merge these drafts "as is", to close #827 (being able to qualify type names and fixing Then I'll create a separate issue for this discussion about further redesign of I'll also document |
There was some annoying repetition in this area. `TableName` and `ColumnName` each had three copy-pasted `From` impls. Now they have one, which will be easier to copy-paste when I add `TypeName` and `FunctionName`. I came up with this while re-doing #922 to add `TypeName`. Related to #927. `types.rs` is getting too long and starting to have visible disjoint "submodules", so I started splitting it. ## PR Info - Dependents: - #922 ## New Features - [x] The new traits are technically an addition, but I wouldn't advertise it. They are not meant to be used directly. I've documented this on the traits.
As discussed here: #827 (comment)
PR Info
Closes Incorrect Quoting of Schema-Qualified Enums in
cast_as_quoted#827Dependencies:
'staticbounds #921Changes
The PR has been updated. The up-to-date description is in the changelog in the diff.
Original, outdated note:
Merge after #921. Marking as draft until then. The first commit comes as a dependency from that PR. If you want to review the diff before merging that PR, review only the second commit.