Skip to content
Browse files

PostgreSQL Timestamps always map to `:datetime`.

The PG Adapter should use `:datetime` consistently instead of mapping
mispellings to `:timestamp`.

See #14513
  • Loading branch information...
1 parent 43101ab commit d080e8c201b7200f7f851c7d837cd658968c5255 @jefflai2 jefflai2 committed
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
14 activerecord/CHANGELOG.md
@@ -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.
View
7 activerecord/lib/active_record/connection_adapters/postgresql/oid.rb
@@ -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 d080e8c

Please sign in to comment.
Something went wrong with that request. Please try again.