{"action":"created","issue":{"url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/845","repository_url":"https://api.github.com/repos/pgjdbc/pgjdbc","labels_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/845/labels{/name}","comments_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/845/comments","events_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/845/events","html_url":"https://github.com/pgjdbc/pgjdbc/issues/845","id":236715250,"number":845,"title":"inserts using CTE's do not allow returning values","user":{"login":"davecramer","id":406518,"avatar_url":"https://avatars2.githubusercontent.com/u/406518?v=3","gravatar_id":"","url":"https://api.github.com/users/davecramer","html_url":"https://github.com/davecramer","followers_url":"https://api.github.com/users/davecramer/followers","following_url":"https://api.github.com/users/davecramer/following{/other_user}","gists_url":"https://api.github.com/users/davecramer/gists{/gist_id}","starred_url":"https://api.github.com/users/davecramer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davecramer/subscriptions","organizations_url":"https://api.github.com/users/davecramer/orgs","repos_url":"https://api.github.com/users/davecramer/repos","events_url":"https://api.github.com/users/davecramer/events{/privacy}","received_events_url":"https://api.github.com/users/davecramer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-06-18T11:20:40Z","updated_at":"2017-07-11T16:47:08Z","closed_at":null,"body":"The following code does not work:\r\n\r\nPreparedStatement ps3 = c.prepareStatement(\"WITH id_temp AS ( select nextval('transportation_point_id_seq') id ) insert into transportation_point values ((select id from id_temp), 'foo')\", new String[]{\"id\"} )) {\r\n\r\n\r\nhere is where the problem lies. We do not add returning if the command is not insert, update or delete.\r\nhttps://github.com/pgjdbc/pgjdbc/blob/2958cc22a6a00609bfbb6eb17d4e401dfe433123/pgjdbc/src/main/java/org/postgresql/core/Parser.java#L272"},"comment":{"url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/comments/314504431","html_url":"https://github.com/pgjdbc/pgjdbc/issues/845#issuecomment-314504431","issue_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/845","id":314504431,"user":{"login":"vlsi","id":213894,"avatar_url":"https://avatars2.githubusercontent.com/u/213894?v=3","gravatar_id":"","url":"https://api.github.com/users/vlsi","html_url":"https://github.com/vlsi","followers_url":"https://api.github.com/users/vlsi/followers","following_url":"https://api.github.com/users/vlsi/following{/other_user}","gists_url":"https://api.github.com/users/vlsi/gists{/gist_id}","starred_url":"https://api.github.com/users/vlsi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vlsi/subscriptions","organizations_url":"https://api.github.com/users/vlsi/orgs","repos_url":"https://api.github.com/users/vlsi/repos","events_url":"https://api.github.com/users/vlsi/events{/privacy}","received_events_url":"https://api.github.com/users/vlsi/received_events","type":"User","site_admin":false},"created_at":"2017-07-11T16:47:08Z","updated_at":"2017-07-11T16:47:08Z","body":"> query with a CTE and expecting to be able to get generated keys\r\n\r\nOnce again: JDBC spec allows client to ask for generated keys always, and the spec says that at worst it would just return empty resultset or so.\r\nThere are frameworks in the wild that execute each and every user-provided query with \"return generated keys\", so we should not append `returning` to plain select statements.\r\n\r\nHere's the discussion: https://github.com/pgjdbc/pgjdbc/issues/488#issuecomment-193352302\r\n\r\n> @isapir: The syntax of the language that our engine processes does not allow us to know in advance whether we need to pass RETURN_GENERATED_KEYS or not, so we always set it on behalf of the user"}}
{"actor":{"display_login":"vlsi"}}