Permalink
Browse files

Merge pull request #14859 from jefflai2/datetime_type

PostgreSQL Timestamps always map to `:datetime`.
  • Loading branch information...
2 parents a5db212 + d080e8c commit 10ed70185a664b34c1177c24b7ab06cd74502183 @senny senny committed Apr 24, 2014
Showing with 15 additions and 6 deletions.
  1. +14 −0 activerecord/CHANGELOG.md
  2. +1 −6 activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
View
@@ -1,3 +1,17 @@
+* PostgreSQL should internally use `:datetime` consistently for TimeStamp. Assures
+ different spellings of timestamps are treated the same.
+
+ Example:
+
+ mytimestamp.simplified_type('timestamp without time zone')
+ # => :datetime
+ mytimestamp.simplified_type('timestamp(6) without time zone')
+ # => also :datetime (previously would be :timestamp)
+
+ See #14513.
+
+ *Jefferson Lai*
+
* `ActiveRecord::Base.no_touching` no longer triggers callbacks or start empty transactions.
Fixes #14841.
@@ -209,12 +209,7 @@ def type_cast(value)
class Timestamp < Type
def type; :timestamp; end
def simplified_type(sql_type)
- case sql_type
- when /^timestamp with(?:out)? time zone$/
- :datetime
- else
- :timestamp
- end
+ :datetime
end
def type_cast(value)

0 comments on commit 10ed701

Please sign in to comment.