{"action":"created","issue":{"url":"https://api.github.com/repos/epgsql/epgsql/issues/86","repository_url":"https://api.github.com/repos/epgsql/epgsql","labels_url":"https://api.github.com/repos/epgsql/epgsql/issues/86/labels{/name}","comments_url":"https://api.github.com/repos/epgsql/epgsql/issues/86/comments","events_url":"https://api.github.com/repos/epgsql/epgsql/issues/86/events","html_url":"https://github.com/epgsql/epgsql/issues/86","id":122561230,"number":86,"title":"(Minor) Inconsistency in delete ... returning","user":{"login":"aherranz","id":13064,"avatar_url":"https://avatars.githubusercontent.com/u/13064?v=3","gravatar_id":"","url":"https://api.github.com/users/aherranz","html_url":"https://github.com/aherranz","followers_url":"https://api.github.com/users/aherranz/followers","following_url":"https://api.github.com/users/aherranz/following{/other_user}","gists_url":"https://api.github.com/users/aherranz/gists{/gist_id}","starred_url":"https://api.github.com/users/aherranz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aherranz/subscriptions","organizations_url":"https://api.github.com/users/aherranz/orgs","repos_url":"https://api.github.com/users/aherranz/repos","events_url":"https://api.github.com/users/aherranz/events{/privacy}","received_events_url":"https://api.github.com/users/aherranz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2015-12-16T17:31:58Z","updated_at":"2016-11-22T00:55:50Z","closed_at":null,"body":"I think there is an inconsistent behaviour in delete...returning statement when no rows are deleted:\n\n``` erlang\n16> pgapp:squery(pre2,\"delete from email_lnk returning *\").\n{ok,2,\n    [{column,<<\"id\">>,text,-1,-1,0},\n     {column,<<\"created\">>,int8,8,-1,0},\n     {column,<<\"email\">>,text,-1,-1,0},\n     {column,<<\"tries\">>,int4,4,-1,0}],\n    [{<<\"_6pj\">>,<<\"1450282807\">>,<<\"aherranz@...\">>,\n      <<\"0\">>},\n     {<<\"MKPh\">>,<<\"1450282813\">>,<<\"aherranz@...\">>,\n      <<\"0\">>}]}\n17> pgapp:squery(pre2,\"delete from email_lnk returning *\").\n{ok,0}\n```\n\nSince I am using _returning_ I would expect the second expression to return\n\n``` erlang\n{ok,0,\n    [{column,<<\"id\">>,text,-1,-1,0},\n     {column,<<\"created\">>,int8,8,-1,0},\n     {column,<<\"email\">>,text,-1,-1,0},\n     {column,<<\"tries\">>,int4,4,-1,0}],\n    []}\n```\n\nAm I wrong?\n"},"comment":{"url":"https://api.github.com/repos/epgsql/epgsql/issues/comments/262115704","html_url":"https://github.com/epgsql/epgsql/issues/86#issuecomment-262115704","issue_url":"https://api.github.com/repos/epgsql/epgsql/issues/86","id":262115704,"user":{"login":"seriyps","id":422014,"avatar_url":"https://avatars.githubusercontent.com/u/422014?v=3","gravatar_id":"","url":"https://api.github.com/users/seriyps","html_url":"https://github.com/seriyps","followers_url":"https://api.github.com/users/seriyps/followers","following_url":"https://api.github.com/users/seriyps/following{/other_user}","gists_url":"https://api.github.com/users/seriyps/gists{/gist_id}","starred_url":"https://api.github.com/users/seriyps/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seriyps/subscriptions","organizations_url":"https://api.github.com/users/seriyps/orgs","repos_url":"https://api.github.com/users/seriyps/repos","events_url":"https://api.github.com/users/seriyps/events{/privacy}","received_events_url":"https://api.github.com/users/seriyps/received_events","type":"User","site_admin":false},"created_at":"2016-11-22T00:55:50Z","updated_at":"2016-11-22T00:55:50Z","body":"Ok, I've just realized that your problem may be related to pgapp, not epgsql driver.\r\nOr it was resolved eventualy some time ago.\r\n\r\nI checked at current `devel` branch:\r\n\r\n```\r\n> {ok, C} = epgsql:connect(#{host => \"localhost\", username => \"postgres\", password => \"postgres\", port => 5433}).\r\n> epgsql:equery(C, \"CREATE TEMPORARY TABLE t(c integer)\").\r\n{ok,[],[]}\r\n> rr(\"include/epgsql.hrl\").\r\n[column,error,statement]\r\n> epgsql:squery(C, \"INSERT INTO t (c) VALUES (1), (2), (3) RETURNING c\").\r\n{ok,3,\r\n    [#column{name = <<\"c\">>,type = int4,size = 4,modifier = -1,\r\n             format = 0}],\r\n    [{<<\"1\">>},{<<\"2\">>},{<<\"3\">>}]}\r\n> epgsql:squery(C, \"DELETE FROM t RETURNING c\").                         \r\n{ok,3,\r\n    [#column{name = <<\"c\">>,type = int4,size = 4,modifier = -1,\r\n             format = 0}],\r\n    [{<<\"1\">>},{<<\"2\">>},{<<\"3\">>}]}\r\n```\r\n\r\nAnd the same for `equery`."}}
{"actor":{"display_login":"seriyps"}}