{"action":"created","issue":{"url":"https://api.github.com/repos/rails/rails/issues/19687","labels_url":"https://api.github.com/repos/rails/rails/issues/19687/labels{/name}","comments_url":"https://api.github.com/repos/rails/rails/issues/19687/comments","events_url":"https://api.github.com/repos/rails/rails/issues/19687/events","html_url":"https://github.com/rails/rails/pull/19687","id":67000530,"number":19687,"title":"Fix uniqueness validation with out of range value.","user":{"login":"Antiarchitect","id":50209,"avatar_url":"https://avatars.githubusercontent.com/u/50209?v=3","gravatar_id":"","url":"https://api.github.com/users/Antiarchitect","html_url":"https://github.com/Antiarchitect","followers_url":"https://api.github.com/users/Antiarchitect/followers","following_url":"https://api.github.com/users/Antiarchitect/following{/other_user}","gists_url":"https://api.github.com/users/Antiarchitect/gists{/gist_id}","starred_url":"https://api.github.com/users/Antiarchitect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Antiarchitect/subscriptions","organizations_url":"https://api.github.com/users/Antiarchitect/orgs","repos_url":"https://api.github.com/users/Antiarchitect/repos","events_url":"https://api.github.com/users/Antiarchitect/events{/privacy}","received_events_url":"https://api.github.com/users/Antiarchitect/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-07T22:03:17Z","updated_at":"2015-04-07T22:04:02Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rails/rails/pulls/19687","html_url":"https://github.com/rails/rails/pull/19687","diff_url":"https://github.com/rails/rails/pull/19687.diff","patch_url":"https://github.com/rails/rails/pull/19687.patch"},"body":"Let's say you have both uniqueness and range validation for PostgreSQL 4 byte integer column:\r\n\r\n```ruby\r\nclass A < ActiveRecord::Base\r\n  PG_MAX_INT = 2147483647\r\n  validates :number, uniqueness: true, inclusion: { 0..PG_MAX_INT }\r\nend\r\n\r\na = A.create(number: (A::PG_MAX_INT + 1))\r\n```\r\nBefore it will raise this:\r\n\r\n```ruby\r\nRangeError: 2147483648 is out of range for ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer with limit 4\r\n```\r\n\r\nNow:\r\n\r\n```ruby\r\na.errors[:number] =>\r\n['is not included in the list'] \r\n```"},"comment":{"url":"https://api.github.com/repos/rails/rails/issues/comments/90745679","html_url":"https://github.com/rails/rails/pull/19687#issuecomment-90745679","issue_url":"https://api.github.com/repos/rails/rails/issues/19687","id":90745679,"user":{"login":"Antiarchitect","id":50209,"avatar_url":"https://avatars.githubusercontent.com/u/50209?v=3","gravatar_id":"","url":"https://api.github.com/users/Antiarchitect","html_url":"https://github.com/Antiarchitect","followers_url":"https://api.github.com/users/Antiarchitect/followers","following_url":"https://api.github.com/users/Antiarchitect/following{/other_user}","gists_url":"https://api.github.com/users/Antiarchitect/gists{/gist_id}","starred_url":"https://api.github.com/users/Antiarchitect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Antiarchitect/subscriptions","organizations_url":"https://api.github.com/users/Antiarchitect/orgs","repos_url":"https://api.github.com/users/Antiarchitect/repos","events_url":"https://api.github.com/users/Antiarchitect/events{/privacy}","received_events_url":"https://api.github.com/users/Antiarchitect/received_events","type":"User","site_admin":false},"created_at":"2015-04-07T22:04:02Z","updated_at":"2015-04-07T22:04:02Z","body":"May be affects master branch too."}}