fix selecting list of fields and map/2 from subquery - #4777
Open
greg-rychlewski wants to merge 6 commits into
Open
fix selecting list of fields and map/2 from subquery#4777greg-rychlewski wants to merge 6 commits into
greg-rychlewski wants to merge 6 commits into
Conversation
Member
Author
|
ah there is some inspect stuff and old tests i need to fix up |
josevalim
approved these changes
Aug 4, 2026
greg-rychlewski
commented
Aug 4, 2026
| assert query.select.fields == [{{:., [type: :string], [{:&, [], [1]}, :title]}, [], []}] | ||
|
|
||
| subquery = from p in Post, select: %{id: p.id, title: p.title} | ||
| subquery = from p in Post, select: struct(p, [:id, :title]) |
Member
Author
There was a problem hiding this comment.
@josevalim The fix was surfacing an error in this test. Basically it fails now because select: [atom()] is considered the same as struct/2 more strictly.
Just want to make sure this is still the right interpretation of the list of atoms. It's in the docs but not sure if it's out of date
It is also possible to select a struct and limit the returned fields at the same time:
from(City, select: [:name])
The syntax above is equivalent to:
from(city in City, select: struct(city, [:name]))
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #4776