aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/connection_adapters
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2014-12-22 09:52:02 -0700
committerSean Griffin <sean@thoughtbot.com>2014-12-22 09:55:41 -0700
commitb0f2b94dd30c9ceae98efe5f5f5a589eb68a6286 (patch)
treea9c9a3750ce7c8bce37808c7ce703a7f0488ae85 /activerecord/lib/active_record/connection_adapters
parent0369808917f7a67b6375aaaa34f20d773ae9b339 (diff)
downloadrails-b0f2b94dd30c9ceae98efe5f5f5a589eb68a6286.tar.gz
rails-b0f2b94dd30c9ceae98efe5f5f5a589eb68a6286.tar.bz2
rails-b0f2b94dd30c9ceae98efe5f5f5a589eb68a6286.zip
Correctly handle limit on int4 and int8 types in PG
PG doesn't register it's types using the `int(4)` format that others do. As such, if we alias `int8` to the other integer types, the range information is lost. This is fixed by simply registering it separately. The other option (which I specifically chose to avoid) is to pass the information of the original type that was being aliased as an argument. I'd rather avoid that, since an alias should truly be treated the same. If we need different behavior for a different type, we should explicitly register it with that, and not have a conditional based on aliasing. Fixes #18144 [Sean Griffin & ysbaddaden]
Diffstat (limited to 'activerecord/lib/active_record/connection_adapters')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 6ef47d8a11..02cafc8079 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -445,8 +445,8 @@ module ActiveRecord
def initialize_type_map(m) # :nodoc:
register_class_with_limit m, 'int2', OID::Integer
- m.alias_type 'int4', 'int2'
- m.alias_type 'int8', 'int2'
+ register_class_with_limit m, 'int4', OID::Integer
+ register_class_with_limit m, 'int8', OID::Integer
m.alias_type 'oid', 'int2'
m.register_type 'float4', OID::Float.new
m.alias_type 'float8', 'float4'