{"action":"opened","issue":{"url":"https://api.github.com/repos/jOOQ/jOOQ/issues/5446","repository_url":"https://api.github.com/repos/jOOQ/jOOQ","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/5446/labels{/name}","comments_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/5446/comments","events_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/5446/events","html_url":"https://github.com/jOOQ/jOOQ/issues/5446","id":167244303,"number":5446,"title":"Unnecessarily costly query to check for Oracle version in code generation","user":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/C:%20Code%20Generation","name":"C: Code Generation","color":"0000aa"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/P:%20Medium","name":"P: Medium","color":"ffaaaa"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/T:%20Defect","name":"T: Defect","color":"cccccc"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/125","html_url":"https://github.com/jOOQ/jOOQ/milestones/Version%203.9.0","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/125/labels","id":1397345,"number":125,"title":"Version 3.9.0","description":"","creator":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"open_issues":422,"closed_issues":113,"state":"open","created_at":"2015-11-06T09:31:19Z","updated_at":"2016-07-24T17:38:36Z","due_on":null,"closed_at":null},"comments":0,"created_at":"2016-07-24T17:38:35Z","updated_at":"2016-07-24T17:38:35Z","closed_at":null,"body":"The current 10g check, for instance, looks like this:\r\n\r\n```java\r\n    boolean is10g() {\r\n        if (is10g == null) {\r\n\r\n            // [#2864] The ALL_MVIEW_COMMENTS view was introduced in Oracle 10g\r\n            try {\r\n                create(true)\r\n                    .selectCount()\r\n                    .from(ALL_MVIEW_COMMENTS)\r\n                    .fetch();\r\n\r\n                is10g = true;\r\n            }\r\n            catch (DataAccessException e) {\r\n                is10g = false;\r\n            }\r\n        }\r\n\r\n        return is10g;\r\n    }\r\n```\r\n\r\nThis could be rather costly in large schemas, when we don't really need the `COUNT(*)` value, but just any value (or an exception in the absence of the dictionary view).\r\n\r\nMuch better:\r\n\r\n```java\r\n    boolean is10g() {\r\n        if (is10g == null) {\r\n\r\n            // [#2864] The ALL_MVIEW_COMMENTS view was introduced in Oracle 10g\r\n            try {\r\n                create(true)\r\n                    .selectOne()\r\n                    .from(ALL_MVIEW_COMMENTS)\r\n                    .where(falseCondition())\r\n                    .fetch();\r\n\r\n                is10g = true;\r\n            }\r\n            catch (DataAccessException e) {\r\n                is10g = false;\r\n            }\r\n        }\r\n\r\n        return is10g;\r\n    }\r\n```"}}
{"actor":{"display_login":"lukaseder"}}