{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/comments/75907235","id":75907235,"diff_hunk":"@@ -165,3 +165,22 @@\n       first\n       :count\n       pos?))\n+\n+(defn get-sequence-name\n+  \"Returns the name of the sequence associated with a column, or nil if there is\n+  no sequence.\"\n+  [db table column]\n+  (-> (jdbc/query db [\"SELECT pg_get_serial_sequence(?, ?)\" table column])\n+      first\n+      :pg_get_serial_sequence))\n+\n+(defn reconcile-sequence!\n+  \"Finds the sequence associated with the given column and sets it to the\n+  current maximum value in that column, so that the next value in the sequence\n+  will be the current maximum + 1 (or 0, if the table is empty). If the column\n+  has no associated sequence, throws an IllegalArgumentException.\"\n+  [db table column]\n+  (if-let [sequence-name (get-sequence-name db table column)]\n+    (jdbc/query db [(format \"SELECT setval('%s', (SELECT COALESCE(max(\\\"%s\\\"), 0) FROM \\\"%s\\\"))\"","path":"src/puppetlabs/jdbc_util/core.clj","position":20,"original_position":20,"commit_id":"dde5d449f0661b57167d8cbdbdc66271008c5270","original_commit_id":"dde5d449f0661b57167d8cbdbdc66271008c5270","user":{"login":"ajroetker","id":3198124,"avatar_url":"https://avatars.githubusercontent.com/u/3198124?v=3","gravatar_id":"","url":"https://api.github.com/users/ajroetker","html_url":"https://github.com/ajroetker","followers_url":"https://api.github.com/users/ajroetker/followers","following_url":"https://api.github.com/users/ajroetker/following{/other_user}","gists_url":"https://api.github.com/users/ajroetker/gists{/gist_id}","starred_url":"https://api.github.com/users/ajroetker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajroetker/subscriptions","organizations_url":"https://api.github.com/users/ajroetker/orgs","repos_url":"https://api.github.com/users/ajroetker/repos","events_url":"https://api.github.com/users/ajroetker/events{/privacy}","received_events_url":"https://api.github.com/users/ajroetker/received_events","type":"User","site_admin":false},"body":"Why do column and table need double quotes?","created_at":"2016-08-23T16:55:44Z","updated_at":"2016-08-23T16:55:44Z","html_url":"https://github.com/puppetlabs/jdbc-util/pull/38#discussion_r75907235","pull_request_url":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/comments/75907235"},"html":{"href":"https://github.com/puppetlabs/jdbc-util/pull/38#discussion_r75907235"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38","id":81559761,"html_url":"https://github.com/puppetlabs/jdbc-util/pull/38","diff_url":"https://github.com/puppetlabs/jdbc-util/pull/38.diff","patch_url":"https://github.com/puppetlabs/jdbc-util/pull/38.patch","issue_url":"https://api.github.com/repos/puppetlabs/jdbc-util/issues/38","number":38,"state":"open","locked":false,"title":"(PE-15626) Add reconcile-sequence! function","user":{"login":"holguinj","id":3395230,"avatar_url":"https://avatars.githubusercontent.com/u/3395230?v=3","gravatar_id":"","url":"https://api.github.com/users/holguinj","html_url":"https://github.com/holguinj","followers_url":"https://api.github.com/users/holguinj/followers","following_url":"https://api.github.com/users/holguinj/following{/other_user}","gists_url":"https://api.github.com/users/holguinj/gists{/gist_id}","starred_url":"https://api.github.com/users/holguinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holguinj/subscriptions","organizations_url":"https://api.github.com/users/holguinj/orgs","repos_url":"https://api.github.com/users/holguinj/repos","events_url":"https://api.github.com/users/holguinj/events{/privacy}","received_events_url":"https://api.github.com/users/holguinj/received_events","type":"User","site_admin":false},"body":"In the event that a sequence object has fallen behind the column it tracks, this function will reset it.\r\n\r\nThis decreases our reliance on pglogical's sequence replication, which was just added and may not be perfectly reliable.","created_at":"2016-08-16T23:04:50Z","updated_at":"2016-08-23T16:55:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f718558cab697c7b61db123c5c292857ce9f25aa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/jdbc-util/issues/38/comments","statuses_url":"https://api.github.com/repos/puppetlabs/jdbc-util/statuses/dde5d449f0661b57167d8cbdbdc66271008c5270","head":{"label":"holguinj:pe-15626-reconcile-sequence","ref":"pe-15626-reconcile-sequence","sha":"dde5d449f0661b57167d8cbdbdc66271008c5270","user":{"login":"holguinj","id":3395230,"avatar_url":"https://avatars.githubusercontent.com/u/3395230?v=3","gravatar_id":"","url":"https://api.github.com/users/holguinj","html_url":"https://github.com/holguinj","followers_url":"https://api.github.com/users/holguinj/followers","following_url":"https://api.github.com/users/holguinj/following{/other_user}","gists_url":"https://api.github.com/users/holguinj/gists{/gist_id}","starred_url":"https://api.github.com/users/holguinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holguinj/subscriptions","organizations_url":"https://api.github.com/users/holguinj/orgs","repos_url":"https://api.github.com/users/holguinj/repos","events_url":"https://api.github.com/users/holguinj/events{/privacy}","received_events_url":"https://api.github.com/users/holguinj/received_events","type":"User","site_admin":false},"repo":{"id":37951764,"name":"jdbc-util","full_name":"holguinj/jdbc-util","owner":{"login":"holguinj","id":3395230,"avatar_url":"https://avatars.githubusercontent.com/u/3395230?v=3","gravatar_id":"","url":"https://api.github.com/users/holguinj","html_url":"https://github.com/holguinj","followers_url":"https://api.github.com/users/holguinj/followers","following_url":"https://api.github.com/users/holguinj/following{/other_user}","gists_url":"https://api.github.com/users/holguinj/gists{/gist_id}","starred_url":"https://api.github.com/users/holguinj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/holguinj/subscriptions","organizations_url":"https://api.github.com/users/holguinj/orgs","repos_url":"https://api.github.com/users/holguinj/repos","events_url":"https://api.github.com/users/holguinj/events{/privacy}","received_events_url":"https://api.github.com/users/holguinj/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/holguinj/jdbc-util","description":"Common jdbc utilities for use in Puppet Labs clojure projects","fork":true,"url":"https://api.github.com/repos/holguinj/jdbc-util","forks_url":"https://api.github.com/repos/holguinj/jdbc-util/forks","keys_url":"https://api.github.com/repos/holguinj/jdbc-util/keys{/key_id}","collaborators_url":"https://api.github.com/repos/holguinj/jdbc-util/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/holguinj/jdbc-util/teams","hooks_url":"https://api.github.com/repos/holguinj/jdbc-util/hooks","issue_events_url":"https://api.github.com/repos/holguinj/jdbc-util/issues/events{/number}","events_url":"https://api.github.com/repos/holguinj/jdbc-util/events","assignees_url":"https://api.github.com/repos/holguinj/jdbc-util/assignees{/user}","branches_url":"https://api.github.com/repos/holguinj/jdbc-util/branches{/branch}","tags_url":"https://api.github.com/repos/holguinj/jdbc-util/tags","blobs_url":"https://api.github.com/repos/holguinj/jdbc-util/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/holguinj/jdbc-util/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/holguinj/jdbc-util/git/refs{/sha}","trees_url":"https://api.github.com/repos/holguinj/jdbc-util/git/trees{/sha}","statuses_url":"https://api.github.com/repos/holguinj/jdbc-util/statuses/{sha}","languages_url":"https://api.github.com/repos/holguinj/jdbc-util/languages","stargazers_url":"https://api.github.com/repos/holguinj/jdbc-util/stargazers","contributors_url":"https://api.github.com/repos/holguinj/jdbc-util/contributors","subscribers_url":"https://api.github.com/repos/holguinj/jdbc-util/subscribers","subscription_url":"https://api.github.com/repos/holguinj/jdbc-util/subscription","commits_url":"https://api.github.com/repos/holguinj/jdbc-util/commits{/sha}","git_commits_url":"https://api.github.com/repos/holguinj/jdbc-util/git/commits{/sha}","comments_url":"https://api.github.com/repos/holguinj/jdbc-util/comments{/number}","issue_comment_url":"https://api.github.com/repos/holguinj/jdbc-util/issues/comments{/number}","contents_url":"https://api.github.com/repos/holguinj/jdbc-util/contents/{+path}","compare_url":"https://api.github.com/repos/holguinj/jdbc-util/compare/{base}...{head}","merges_url":"https://api.github.com/repos/holguinj/jdbc-util/merges","archive_url":"https://api.github.com/repos/holguinj/jdbc-util/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/holguinj/jdbc-util/downloads","issues_url":"https://api.github.com/repos/holguinj/jdbc-util/issues{/number}","pulls_url":"https://api.github.com/repos/holguinj/jdbc-util/pulls{/number}","milestones_url":"https://api.github.com/repos/holguinj/jdbc-util/milestones{/number}","notifications_url":"https://api.github.com/repos/holguinj/jdbc-util/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/holguinj/jdbc-util/labels{/name}","releases_url":"https://api.github.com/repos/holguinj/jdbc-util/releases{/id}","deployments_url":"https://api.github.com/repos/holguinj/jdbc-util/deployments","created_at":"2015-06-24T00:02:27Z","updated_at":"2015-06-24T00:02:28Z","pushed_at":"2016-08-17T23:42:51Z","git_url":"git://github.com/holguinj/jdbc-util.git","ssh_url":"git@github.com:holguinj/jdbc-util.git","clone_url":"https://github.com/holguinj/jdbc-util.git","svn_url":"https://github.com/holguinj/jdbc-util","homepage":null,"size":108,"stargazers_count":0,"watchers_count":0,"language":"Clojure","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":"puppetlabs:master","ref":"master","sha":"03b2da6827117be7b1851f698ef4ae297908ec32","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":18688473,"name":"jdbc-util","full_name":"puppetlabs/jdbc-util","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/jdbc-util","description":"Common jdbc utilities for use in Puppet Labs clojure projects","fork":false,"url":"https://api.github.com/repos/puppetlabs/jdbc-util","forks_url":"https://api.github.com/repos/puppetlabs/jdbc-util/forks","keys_url":"https://api.github.com/repos/puppetlabs/jdbc-util/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/jdbc-util/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/jdbc-util/teams","hooks_url":"https://api.github.com/repos/puppetlabs/jdbc-util/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/jdbc-util/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/jdbc-util/events","assignees_url":"https://api.github.com/repos/puppetlabs/jdbc-util/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/jdbc-util/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/jdbc-util/tags","blobs_url":"https://api.github.com/repos/puppetlabs/jdbc-util/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/jdbc-util/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/jdbc-util/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/jdbc-util/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/jdbc-util/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/jdbc-util/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/jdbc-util/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/jdbc-util/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/jdbc-util/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/jdbc-util/subscription","commits_url":"https://api.github.com/repos/puppetlabs/jdbc-util/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/jdbc-util/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/jdbc-util/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/jdbc-util/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/jdbc-util/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/jdbc-util/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/jdbc-util/merges","archive_url":"https://api.github.com/repos/puppetlabs/jdbc-util/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/jdbc-util/downloads","issues_url":"https://api.github.com/repos/puppetlabs/jdbc-util/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/jdbc-util/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/jdbc-util/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/jdbc-util/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/jdbc-util/releases{/id}","deployments_url":"https://api.github.com/repos/puppetlabs/jdbc-util/deployments","created_at":"2014-04-11T20:55:57Z","updated_at":"2016-05-29T01:39:17Z","pushed_at":"2016-08-22T18:27:52Z","git_url":"git://github.com/puppetlabs/jdbc-util.git","ssh_url":"git@github.com:puppetlabs/jdbc-util.git","clone_url":"https://github.com/puppetlabs/jdbc-util.git","svn_url":"https://github.com/puppetlabs/jdbc-util","homepage":null,"size":161,"stargazers_count":3,"watchers_count":3,"language":"Clojure","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":2,"forks":13,"open_issues":2,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38"},"html":{"href":"https://github.com/puppetlabs/jdbc-util/pull/38"},"issue":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/issues/38"},"comments":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/jdbc-util/statuses/dde5d449f0661b57167d8cbdbdc66271008c5270"}}}}
{"actor":{"display_login":"ajroetker"}}