{"action":"created","issue":{"url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2603","repository_url":"https://api.github.com/repos/elixir-ecto/ecto","labels_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2603/labels{/name}","comments_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2603/comments","events_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2603/events","html_url":"https://github.com/elixir-ecto/ecto/pull/2603","id":334950480,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk2NzkyNjQ3","number":2603,"title":"Repo.delete exception not documented","user":{"login":"fmcgeough","id":663225,"node_id":"MDQ6VXNlcjY2MzIyNQ==","avatar_url":"https://avatars3.githubusercontent.com/u/663225?v=4","gravatar_id":"","url":"https://api.github.com/users/fmcgeough","html_url":"https://github.com/fmcgeough","followers_url":"https://api.github.com/users/fmcgeough/followers","following_url":"https://api.github.com/users/fmcgeough/following{/other_user}","gists_url":"https://api.github.com/users/fmcgeough/gists{/gist_id}","starred_url":"https://api.github.com/users/fmcgeough/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fmcgeough/subscriptions","organizations_url":"https://api.github.com/users/fmcgeough/orgs","repos_url":"https://api.github.com/users/fmcgeough/repos","events_url":"https://api.github.com/users/fmcgeough/events{/privacy}","received_events_url":"https://api.github.com/users/fmcgeough/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2018-06-22T16:57:21Z","updated_at":"2018-09-18T17:30:33Z","closed_at":"2018-06-22T18:01:03Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/elixir-ecto/ecto/pulls/2603","html_url":"https://github.com/elixir-ecto/ecto/pull/2603","diff_url":"https://github.com/elixir-ecto/ecto/pull/2603.diff","patch_url":"https://github.com/elixir-ecto/ecto/pull/2603.patch"},"body":"If a row is already deleted from db Repo.delete raises Ecto.StaleEntryError.\r\nThis change docs this for the API."},"comment":{"url":"https://api.github.com/repos/elixir-ecto/ecto/issues/comments/422480321","html_url":"https://github.com/elixir-ecto/ecto/pull/2603#issuecomment-422480321","issue_url":"https://api.github.com/repos/elixir-ecto/ecto/issues/2603","id":422480321,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjQ4MDMyMQ==","user":{"login":"mguimas","id":13681899,"node_id":"MDQ6VXNlcjEzNjgxODk5","avatar_url":"https://avatars1.githubusercontent.com/u/13681899?v=4","gravatar_id":"","url":"https://api.github.com/users/mguimas","html_url":"https://github.com/mguimas","followers_url":"https://api.github.com/users/mguimas/followers","following_url":"https://api.github.com/users/mguimas/following{/other_user}","gists_url":"https://api.github.com/users/mguimas/gists{/gist_id}","starred_url":"https://api.github.com/users/mguimas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mguimas/subscriptions","organizations_url":"https://api.github.com/users/mguimas/orgs","repos_url":"https://api.github.com/users/mguimas/repos","events_url":"https://api.github.com/users/mguimas/events{/privacy}","received_events_url":"https://api.github.com/users/mguimas/received_events","type":"User","site_admin":false},"created_at":"2018-09-18T17:30:33Z","updated_at":"2018-09-18T17:30:33Z","author_association":"NONE","body":"@josevalim Ok, I tested this\r\n\r\n```\r\niex(156)> x = %Avatar{nick_name: \"fellowguy\", user_id: 1} |> change |> foreign_key_constraint(:user_id) |>  Repo.insert\r\n\r\n18:24:04.979 [debug] QUERY OK db=0.7ms\r\nbegin []\r\n\r\n18:24:04.982 [debug] QUERY ERROR db=2.5ms\r\nINSERT INTO \"avatars\" (\"nick_name\",\"user_id\") VALUES ($1,$2) RETURNING \"id\" [\"fellowguy\", 1]\r\n\r\n18:24:04.983 [debug] QUERY OK db=1.7ms\r\nrollback []\r\n{:error,\r\n #Ecto.Changeset<\r\n   action: :insert,\r\n   changes: %{nick_name: \"fellowguy\", user_id: 1},\r\n   errors: [user_id: {\"does not exist\", []}],\r\n   data: #EctoAssoc.Avatar<>,\r\n   valid?: false\r\n >}\r\n```\r\n\r\nand adding an entry in `errors` seems more appropriate then.\r\n\r\nBut, why not put the error automatically on the primary key, like in this example? I am not seeing other `Ecto.StaleEntryError` situations when passing a struct or changset to a `Repo.update` or `Repo.delete` functions. \r\n"}}
{"actor":{"display_login":"mguimas"}}