Skip to content

support select-merging into a source within a subquery#4680

Closed
zachdaniel wants to merge 2 commits intoelixir-ecto:masterfrom
zachdaniel:support-select-merge-from-subquery
Closed

support select-merging into a source within a subquery#4680
zachdaniel wants to merge 2 commits intoelixir-ecto:masterfrom
zachdaniel:support-select-merge-from-subquery

Conversation

@zachdaniel
Copy link
Copy Markdown
Contributor

The example test is a bit goofy but it is a result of me paring down a more complex operation from the AshPostgres query builder. Hopefully it makes sense 😄.

Open to improving the test and/or the actual fix itself.

defp classify_merge({:merge, _, [{:&, meta, [ix]} | _rest]}, take) do
case take do
%{^ix => {:map, _}} -> {:map, meta, :runtime}
_ -> {:source_with_extra, meta, ix}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assumption here is that any required validations on those extra fields would have been done in the original select_merge that produces this. So this is just telling us what the original source was.

@josevalim
Copy link
Copy Markdown
Member

Apologies but I am not feeling very confident with those changes. It seems we are only asking for more corner cases to be added further down the road. If we are going to support merge, then we need to investigate all possible combinations right now. Merge with sources, schemas, structs, maps, etc.

@zachdaniel
Copy link
Copy Markdown
Contributor Author

I was about to push back but I think I may just be misunderstanding the problem I'm trying to solve regardless, will revisit later 😄

@zachdaniel zachdaniel closed this Nov 16, 2025
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

Successfully merging this pull request may close these issues.

2 participants