ecto
ecto copied to clipboard
Support `select: map(x, fields), select_merge: %{...}` in source query for insert_all
Elixir version
1.16.3
Database and Version
PostgreSQL 15.0
Ecto Versions
master
Database Adapter and Versions (postgrex, myxql, etc)
postgrex
Current behavior
Repo.insert_all(Foo, from x in Foo, select: %{foo: x.foo, bar: x.bar}, select_merge: %{baz: some_fun(x.baz)})
works as intended.
Repo.insert_all(Foo, from x in Foo, select: map(x, [:foo, :bar]), select_merge: %{baz: some_fun(x.baz)})
raises an ArgumentError stating that the source query does not select into a map.
Expected behavior
The above two snippets should both be supported as they should result in the same source query being produced.
I would be happy to take a stab at this if this is indeed the intended behaviour.