{"action":"closed","issue":{"url":"https://api.github.com/repos/h2database/h2database/issues/299","repository_url":"https://api.github.com/repos/h2database/h2database","labels_url":"https://api.github.com/repos/h2database/h2database/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/h2database/h2database/issues/299/comments","events_url":"https://api.github.com/repos/h2database/h2database/issues/299/events","html_url":"https://github.com/h2database/h2database/issues/299","id":158224559,"number":299,"title":"left join does not work as expected","user":{"login":"ocadaruma","id":6070684,"avatar_url":"https://avatars.githubusercontent.com/u/6070684?v=3","gravatar_id":"","url":"https://api.github.com/users/ocadaruma","html_url":"https://github.com/ocadaruma","followers_url":"https://api.github.com/users/ocadaruma/followers","following_url":"https://api.github.com/users/ocadaruma/following{/other_user}","gists_url":"https://api.github.com/users/ocadaruma/gists{/gist_id}","starred_url":"https://api.github.com/users/ocadaruma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocadaruma/subscriptions","organizations_url":"https://api.github.com/users/ocadaruma/orgs","repos_url":"https://api.github.com/users/ocadaruma/repos","events_url":"https://api.github.com/users/ocadaruma/events{/privacy}","received_events_url":"https://api.github.com/users/ocadaruma/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-02T19:49:37Z","updated_at":"2016-06-08T05:51:04Z","closed_at":"2016-06-08T05:51:04Z","body":"I got strange result by left join between subqueries. H2 version is 1.4.192.\r\n\r\nSee following queries and comments.\r\n\r\n```sql\r\n-- ddl\r\ncreate table foo(a int not null, b int, c int);\r\ncreate table bar(a int not null, b int, c int, d int);\r\n\r\ninsert into foo(a, b, c) values (1, 1, 1);\r\ninsert into bar(a, b, c, d) values (1, 1, 1, 42);\r\n\r\n-- [query1] This query should return 42, but returns null.\r\nselect\r\n   bar_d\r\nfrom\r\n   (select\r\n      fff.a as foo_a,\r\n      fff.b as foo_b,\r\n      fff.c as foo_c\r\n   from\r\n      foo fff) tmp\r\nleft join\r\n   (select\r\n      bbb.a as bar_a,\r\n      bbb.b as bar_b,\r\n      bbb.c as bar_c,\r\n      bbb.d as bar_d\r\n   from\r\n      (select a, b, c, d from bar) bbb\r\n   where\r\n      bbb.a between 0 and 100\r\n   ) sp\r\n   on tmp.foo_a = sp.bar_a\r\n   and tmp.foo_b = sp.bar_b\r\n   and tmp.foo_c = sp.bar_c;\r\n   \r\n-- [query2] Change column order in select clause. This query returns 42 as expected. Why ?\r\nselect\r\n   bar_d\r\nfrom\r\n   (select\r\n      fff.a as foo_a,\r\n      fff.b as foo_b,\r\n      fff.c as foo_c\r\n   from\r\n      foo fff) tmp\r\nleft join\r\n   (select\r\n      bbb.a as bar_a,\r\n      bbb.b as bar_b,\r\n      bbb.c as bar_c,\r\n      bbb.d as bar_d\r\n   from\r\n      (select b, a, c, d from bar) bbb\r\n   where\r\n      bbb.a between 0 and 100\r\n   ) sp\r\n   on tmp.foo_a = sp.bar_a\r\n   and tmp.foo_b = sp.bar_b\r\n   and tmp.foo_c = sp.bar_c;\r\n   \r\n-- query[3] Change between to = in where clause. This query returns 42 too. Why ?\r\nselect\r\n   bar_d\r\nfrom\r\n   (select\r\n      fff.a as foo_a,\r\n      fff.b as foo_b,\r\n      fff.c as foo_c\r\n   from\r\n      foo fff) tmp\r\nleft join\r\n   (select\r\n      bbb.a as bar_a,\r\n      bbb.b as bar_b,\r\n      bbb.c as bar_c,\r\n      bbb.d as bar_d\r\n   from\r\n      (select a, b, c, d from bar) bbb\r\n   where\r\n      bbb.a = 1\r\n   ) sp\r\n   on tmp.foo_a = sp.bar_a\r\n   and tmp.foo_b = sp.bar_b\r\n   and tmp.foo_c = sp.bar_c;\r\n```"}}
{"actor":{"display_login":"thomasmueller"}}