{"action":"created","comment":{"url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/comments/82158847","pull_request_review_id":3084723,"id":82158847,"diff_hunk":"@@ -1180,10 +1165,143 @@ private static String escapeFunction(String functionName, String args, boolean s\n \n   // Static variables for parsing SQL when replaceProcessing is true.\n   private enum SqlParseState {\n-    IN_SQLCODE,\n-    ESC_TIMEDATE,\n-    ESC_FUNCTION,\n-    ESC_OUTERJOIN,\n-    ESC_ESCAPECHAR;\n+    IN_SQLCODE {\n+      char[] keyword = new char[0];\n+\n+      @Override\n+      char[] escapeKeyword() {\n+        return keyword;\n+      }\n+    },\n+    ESC_DATE {\n+      char[] keyword = new char[]{'d'};\n+      String replacementKeyword = \"DATE \";\n+\n+      @Override\n+      char[] escapeKeyword() {\n+        return keyword;\n+      }\n+\n+      @Override\n+      String replacementKeyword() {\n+        return replacementKeyword;","path":"pgjdbc/src/main/java/org/postgresql/core/Parser.java","position":119,"original_position":119,"commit_id":"d54da45b0ab3709c159e53dcb3d9d14bb1cc11ee","original_commit_id":"d54da45b0ab3709c159e53dcb3d9d14bb1cc11ee","user":{"login":"vlsi","id":213894,"avatar_url":"https://avatars.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},"body":"Can this be factored out to `enum constructor`?\r\nThat is just add `char[] keyword` and `String replacement` fields to `SqlParseState` instance and avoid duplicating the logic in overridden methods.","created_at":"2016-10-06T10:30:01Z","updated_at":"2016-10-06T10:32:13Z","html_url":"https://github.com/pgjdbc/pgjdbc/pull/657#discussion_r82158847","pull_request_url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657","_links":{"self":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/comments/82158847"},"html":{"href":"https://github.com/pgjdbc/pgjdbc/pull/657#discussion_r82158847"},"pull_request":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657"}}},"pull_request":{"url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657","id":88234582,"html_url":"https://github.com/pgjdbc/pgjdbc/pull/657","diff_url":"https://github.com/pgjdbc/pgjdbc/pull/657.diff","patch_url":"https://github.com/pgjdbc/pgjdbc/pull/657.patch","issue_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/657","number":657,"state":"open","locked":false,"title":"makes escape processing strict according to JDBC spec","user":{"login":"seut","id":219690,"avatar_url":"https://avatars.githubusercontent.com/u/219690?v=3","gravatar_id":"","url":"https://api.github.com/users/seut","html_url":"https://github.com/seut","followers_url":"https://api.github.com/users/seut/followers","following_url":"https://api.github.com/users/seut/following{/other_user}","gists_url":"https://api.github.com/users/seut/gists{/gist_id}","starred_url":"https://api.github.com/users/seut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seut/subscriptions","organizations_url":"https://api.github.com/users/seut/orgs","repos_url":"https://api.github.com/users/seut/repos","events_url":"https://api.github.com/users/seut/events{/privacy}","received_events_url":"https://api.github.com/users/seut/received_events","type":"User","site_admin":false},"body":"Before, escape code parsing was very lenient and invalid escape code formats were accidentally processed.\r\n\r\nI've also added a JMH benchmark, so it seems that my new implementation even runs slightly faster:\r\n\r\n### MASTER\r\nResult \"escapeFunctionWithDate\":\r\n  677.556 ±(99.9%) 7.699 ns/op [Average]\r\n  (min, avg, max) = (638.185, 677.556, 741.213), stdev = 22.701\r\n  CI (99.9%): [669.856, 685.255] (assumes normal distribution)\r\n\r\n### s/strict-escape-processing\r\nResult \"escapeFunctionWithDate\":\r\n  666.126 ±(99.9%) 5.878 ns/op [Average]\r\n  (min, avg, max) = (633.941, 666.126, 704.415), stdev = 17.333\r\n  CI (99.9%): [660.247, 672.004] (assumes normal distribution)\r\n\r\nReason for coming across this is that at crate (https://github.com/crate/crate), we've experimentally implemented the PostgreSQL wire protocol for client connections. crate supports object literals like e.g. `{ o1 = 'string'}` (http://crate.readthedocs.io/en/latest/sql/data_types.html#object-literals) which were wrongly interpreted as an outerjoin escape code by the existing implementation. \r\n","created_at":"2016-10-06T10:18:40Z","updated_at":"2016-10-06T10:32:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"abbc8c73754e5f4b87ceaf01599c5925fedd06f3","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657/commits","review_comments_url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657/comments","review_comment_url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/657/comments","statuses_url":"https://api.github.com/repos/pgjdbc/pgjdbc/statuses/d54da45b0ab3709c159e53dcb3d9d14bb1cc11ee","head":{"label":"seut:s/strict-escape-processing","ref":"s/strict-escape-processing","sha":"d54da45b0ab3709c159e53dcb3d9d14bb1cc11ee","user":{"login":"seut","id":219690,"avatar_url":"https://avatars.githubusercontent.com/u/219690?v=3","gravatar_id":"","url":"https://api.github.com/users/seut","html_url":"https://github.com/seut","followers_url":"https://api.github.com/users/seut/followers","following_url":"https://api.github.com/users/seut/following{/other_user}","gists_url":"https://api.github.com/users/seut/gists{/gist_id}","starred_url":"https://api.github.com/users/seut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seut/subscriptions","organizations_url":"https://api.github.com/users/seut/orgs","repos_url":"https://api.github.com/users/seut/repos","events_url":"https://api.github.com/users/seut/events{/privacy}","received_events_url":"https://api.github.com/users/seut/received_events","type":"User","site_admin":false},"repo":{"id":70061653,"name":"pgjdbc","full_name":"seut/pgjdbc","owner":{"login":"seut","id":219690,"avatar_url":"https://avatars.githubusercontent.com/u/219690?v=3","gravatar_id":"","url":"https://api.github.com/users/seut","html_url":"https://github.com/seut","followers_url":"https://api.github.com/users/seut/followers","following_url":"https://api.github.com/users/seut/following{/other_user}","gists_url":"https://api.github.com/users/seut/gists{/gist_id}","starred_url":"https://api.github.com/users/seut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/seut/subscriptions","organizations_url":"https://api.github.com/users/seut/orgs","repos_url":"https://api.github.com/users/seut/repos","events_url":"https://api.github.com/users/seut/events{/privacy}","received_events_url":"https://api.github.com/users/seut/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/seut/pgjdbc","description":"Postgresql JDBC Driver","fork":true,"url":"https://api.github.com/repos/seut/pgjdbc","forks_url":"https://api.github.com/repos/seut/pgjdbc/forks","keys_url":"https://api.github.com/repos/seut/pgjdbc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/seut/pgjdbc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/seut/pgjdbc/teams","hooks_url":"https://api.github.com/repos/seut/pgjdbc/hooks","issue_events_url":"https://api.github.com/repos/seut/pgjdbc/issues/events{/number}","events_url":"https://api.github.com/repos/seut/pgjdbc/events","assignees_url":"https://api.github.com/repos/seut/pgjdbc/assignees{/user}","branches_url":"https://api.github.com/repos/seut/pgjdbc/branches{/branch}","tags_url":"https://api.github.com/repos/seut/pgjdbc/tags","blobs_url":"https://api.github.com/repos/seut/pgjdbc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/seut/pgjdbc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/seut/pgjdbc/git/refs{/sha}","trees_url":"https://api.github.com/repos/seut/pgjdbc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/seut/pgjdbc/statuses/{sha}","languages_url":"https://api.github.com/repos/seut/pgjdbc/languages","stargazers_url":"https://api.github.com/repos/seut/pgjdbc/stargazers","contributors_url":"https://api.github.com/repos/seut/pgjdbc/contributors","subscribers_url":"https://api.github.com/repos/seut/pgjdbc/subscribers","subscription_url":"https://api.github.com/repos/seut/pgjdbc/subscription","commits_url":"https://api.github.com/repos/seut/pgjdbc/commits{/sha}","git_commits_url":"https://api.github.com/repos/seut/pgjdbc/git/commits{/sha}","comments_url":"https://api.github.com/repos/seut/pgjdbc/comments{/number}","issue_comment_url":"https://api.github.com/repos/seut/pgjdbc/issues/comments{/number}","contents_url":"https://api.github.com/repos/seut/pgjdbc/contents/{+path}","compare_url":"https://api.github.com/repos/seut/pgjdbc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/seut/pgjdbc/merges","archive_url":"https://api.github.com/repos/seut/pgjdbc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/seut/pgjdbc/downloads","issues_url":"https://api.github.com/repos/seut/pgjdbc/issues{/number}","pulls_url":"https://api.github.com/repos/seut/pgjdbc/pulls{/number}","milestones_url":"https://api.github.com/repos/seut/pgjdbc/milestones{/number}","notifications_url":"https://api.github.com/repos/seut/pgjdbc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/seut/pgjdbc/labels{/name}","releases_url":"https://api.github.com/repos/seut/pgjdbc/releases{/id}","deployments_url":"https://api.github.com/repos/seut/pgjdbc/deployments","created_at":"2016-10-05T13:11:04Z","updated_at":"2016-10-05T13:11:06Z","pushed_at":"2016-10-06T10:08:13Z","git_url":"git://github.com/seut/pgjdbc.git","ssh_url":"git@github.com:seut/pgjdbc.git","clone_url":"https://github.com/seut/pgjdbc.git","svn_url":"https://github.com/seut/pgjdbc","homepage":"http://jdbc.postgresql.org","size":13663,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pgjdbc:master","ref":"master","sha":"7270435aebc204df72c388bcdd47b17d64dbe21f","user":{"login":"pgjdbc","id":1371956,"avatar_url":"https://avatars.githubusercontent.com/u/1371956?v=3","gravatar_id":"","url":"https://api.github.com/users/pgjdbc","html_url":"https://github.com/pgjdbc","followers_url":"https://api.github.com/users/pgjdbc/followers","following_url":"https://api.github.com/users/pgjdbc/following{/other_user}","gists_url":"https://api.github.com/users/pgjdbc/gists{/gist_id}","starred_url":"https://api.github.com/users/pgjdbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgjdbc/subscriptions","organizations_url":"https://api.github.com/users/pgjdbc/orgs","repos_url":"https://api.github.com/users/pgjdbc/repos","events_url":"https://api.github.com/users/pgjdbc/events{/privacy}","received_events_url":"https://api.github.com/users/pgjdbc/received_events","type":"Organization","site_admin":false},"repo":{"id":3370128,"name":"pgjdbc","full_name":"pgjdbc/pgjdbc","owner":{"login":"pgjdbc","id":1371956,"avatar_url":"https://avatars.githubusercontent.com/u/1371956?v=3","gravatar_id":"","url":"https://api.github.com/users/pgjdbc","html_url":"https://github.com/pgjdbc","followers_url":"https://api.github.com/users/pgjdbc/followers","following_url":"https://api.github.com/users/pgjdbc/following{/other_user}","gists_url":"https://api.github.com/users/pgjdbc/gists{/gist_id}","starred_url":"https://api.github.com/users/pgjdbc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgjdbc/subscriptions","organizations_url":"https://api.github.com/users/pgjdbc/orgs","repos_url":"https://api.github.com/users/pgjdbc/repos","events_url":"https://api.github.com/users/pgjdbc/events{/privacy}","received_events_url":"https://api.github.com/users/pgjdbc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pgjdbc/pgjdbc","description":"Postgresql JDBC Driver","fork":false,"url":"https://api.github.com/repos/pgjdbc/pgjdbc","forks_url":"https://api.github.com/repos/pgjdbc/pgjdbc/forks","keys_url":"https://api.github.com/repos/pgjdbc/pgjdbc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pgjdbc/pgjdbc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pgjdbc/pgjdbc/teams","hooks_url":"https://api.github.com/repos/pgjdbc/pgjdbc/hooks","issue_events_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/events{/number}","events_url":"https://api.github.com/repos/pgjdbc/pgjdbc/events","assignees_url":"https://api.github.com/repos/pgjdbc/pgjdbc/assignees{/user}","branches_url":"https://api.github.com/repos/pgjdbc/pgjdbc/branches{/branch}","tags_url":"https://api.github.com/repos/pgjdbc/pgjdbc/tags","blobs_url":"https://api.github.com/repos/pgjdbc/pgjdbc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pgjdbc/pgjdbc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pgjdbc/pgjdbc/git/refs{/sha}","trees_url":"https://api.github.com/repos/pgjdbc/pgjdbc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pgjdbc/pgjdbc/statuses/{sha}","languages_url":"https://api.github.com/repos/pgjdbc/pgjdbc/languages","stargazers_url":"https://api.github.com/repos/pgjdbc/pgjdbc/stargazers","contributors_url":"https://api.github.com/repos/pgjdbc/pgjdbc/contributors","subscribers_url":"https://api.github.com/repos/pgjdbc/pgjdbc/subscribers","subscription_url":"https://api.github.com/repos/pgjdbc/pgjdbc/subscription","commits_url":"https://api.github.com/repos/pgjdbc/pgjdbc/commits{/sha}","git_commits_url":"https://api.github.com/repos/pgjdbc/pgjdbc/git/commits{/sha}","comments_url":"https://api.github.com/repos/pgjdbc/pgjdbc/comments{/number}","issue_comment_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/comments{/number}","contents_url":"https://api.github.com/repos/pgjdbc/pgjdbc/contents/{+path}","compare_url":"https://api.github.com/repos/pgjdbc/pgjdbc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pgjdbc/pgjdbc/merges","archive_url":"https://api.github.com/repos/pgjdbc/pgjdbc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pgjdbc/pgjdbc/downloads","issues_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues{/number}","pulls_url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls{/number}","milestones_url":"https://api.github.com/repos/pgjdbc/pgjdbc/milestones{/number}","notifications_url":"https://api.github.com/repos/pgjdbc/pgjdbc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pgjdbc/pgjdbc/labels{/name}","releases_url":"https://api.github.com/repos/pgjdbc/pgjdbc/releases{/id}","deployments_url":"https://api.github.com/repos/pgjdbc/pgjdbc/deployments","created_at":"2012-02-06T19:30:35Z","updated_at":"2016-10-06T07:05:34Z","pushed_at":"2016-10-06T10:18:40Z","git_url":"git://github.com/pgjdbc/pgjdbc.git","ssh_url":"git@github.com:pgjdbc/pgjdbc.git","clone_url":"https://github.com/pgjdbc/pgjdbc.git","svn_url":"https://github.com/pgjdbc/pgjdbc","homepage":"http://jdbc.postgresql.org","size":16181,"stargazers_count":259,"watchers_count":259,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":221,"mirror_url":null,"open_issues_count":131,"forks":221,"open_issues":131,"watchers":259,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657"},"html":{"href":"https://github.com/pgjdbc/pgjdbc/pull/657"},"issue":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/657"},"comments":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/657/comments"},"review_comments":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657/comments"},"review_comment":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/657/commits"},"statuses":{"href":"https://api.github.com/repos/pgjdbc/pgjdbc/statuses/d54da45b0ab3709c159e53dcb3d9d14bb1cc11ee"}}}}
{"actor":{"display_login":"vlsi"}}