{"action":"closed","issue":{"url":"https://api.github.com/repos/elixir-lang/ecto/issues/1322","repository_url":"https://api.github.com/repos/elixir-lang/ecto","labels_url":"https://api.github.com/repos/elixir-lang/ecto/issues/1322/labels{/name}","comments_url":"https://api.github.com/repos/elixir-lang/ecto/issues/1322/comments","events_url":"https://api.github.com/repos/elixir-lang/ecto/issues/1322/events","html_url":"https://github.com/elixir-lang/ecto/issues/1322","id":141210901,"number":1322,"title":"Loops inside Repo Transaction","user":{"login":"radik909","id":12206810,"avatar_url":"https://avatars.githubusercontent.com/u/12206810?v=3","gravatar_id":"","url":"https://api.github.com/users/radik909","html_url":"https://github.com/radik909","followers_url":"https://api.github.com/users/radik909/followers","following_url":"https://api.github.com/users/radik909/following{/other_user}","gists_url":"https://api.github.com/users/radik909/gists{/gist_id}","starred_url":"https://api.github.com/users/radik909/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radik909/subscriptions","organizations_url":"https://api.github.com/users/radik909/orgs","repos_url":"https://api.github.com/users/radik909/repos","events_url":"https://api.github.com/users/radik909/events{/privacy}","received_events_url":"https://api.github.com/users/radik909/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-03-16T08:59:59Z","updated_at":"2016-03-16T09:29:49Z","closed_at":"2016-03-16T09:29:49Z","body":"### Environment\r\n\r\n* Elixir version (elixir -v): 1.2.3\r\n* Database and version (PostgreSQL 9.4, MongoDB 3.2, etc.): Postgresql 9.4\r\n* Ecto version (mix deps): 1.1.3\r\n* Database adapter and version (mix deps): Postgrex 0.11.0\r\n* Operating system: Ubuntu 14.04\r\n\r\nUser model has unique_constraint(:email)\r\n\r\n```elixir\r\nRepo.transaction(fn ->\r\n  Enum.each(emails, fn(email) ->\r\n    changeset = User.changeset(%User{}, %{email: email})\r\n    Repo.insert!(changeset)\r\n  end)\r\nend)\r\n```\r\n\r\nWhen `emails = [\"aaa@aaa.com\", \"aaa@aaa.com\"]` the above code breaks! \r\nI want the code to return `{:error, _anything}`\r\nWhat am I supposed to do???"}}