Hi all,

I am in a bit of a pickle, when I use Ecto.Multi.insert() and, I am to pipe down to the transaction and case the result as shown below;

|> Repo.transaction()
    |> case do
      {:ok, %{user: user, user_log: _user_log}}

However, when I use Ecto.Multi.insert_all(), I get the below exampled:

|> Repo.transaction()
    |> case do
      {:ok, %{user: user, user_log:  {2,nil} }}

Question: Is there a way of returning a list of structs of the inserted values rather the the tuple {2, nil}

The docs of Ecto.Repo.insert_all say that if your DB does not support RETURNING then the 2nd element in that tuple will be nil.

Have you tried calling insert_all like so? If your DB supports RETURNING then you should get list of structs and not nil.

Multi.insert_all(YourSchema, list_of_records, returning: true)