From d070a657c006ccbcba1b24111f1c8b21b8b9b1c9 Mon Sep 17 00:00:00 2001 From: Sean Griffin Date: Sat, 17 May 2014 14:04:23 -0600 Subject: [PATCH] PostgreSQL timestamps are always datetimes The current behavior is that they are treated as `datetime` normally, but if they are part of an array, they are treated as `timestamp`. The only place that seems to be impacted by this is schema dumping, which shouldn't matter since `t.datetime` and `t.timestamp` are equivalent in the `PostgreSQL` adapter, anyway. --- .../active_record/connection_adapters/postgresql/oid.rb | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb index cf6a375704..a32915f363 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql/oid.rb @@ -204,11 +204,8 @@ This is not reliable and will be removed in the future. end end - class Timestamp < Type - def type; :timestamp; end - def simplified_type(sql_type) - :datetime - end + class DateTime < Type + def type; :datetime; end def type_cast(value) return if value.nil? @@ -483,7 +480,7 @@ This is not reliable and will be removed in the future. register_type 'bool', OID::Boolean.new register_type 'bit', OID::Bit.new alias_type 'varbit', 'bit' - register_type 'timestamp', OID::Timestamp.new + register_type 'timestamp', OID::DateTime.new alias_type 'timestamptz', 'timestamp' register_type 'date', OID::Date.new register_type 'time', OID::Time.new