aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorYasuo Honda <yasuo.honda@gmail.com>2017-04-26 04:45:08 +0000
committerYasuo Honda <yasuo.honda@gmail.com>2017-04-26 14:29:22 +0000
commit4181b677e5164a18fe25767c5bf9eeb3df800231 (patch)
tree9788a666aa2457ccc9ed62e68e1e9e0290bae9d3 /activerecord/lib/active_record
parentdeba47799ff905f778e0c98a015789a1327d5087 (diff)
downloadrails-4181b677e5164a18fe25767c5bf9eeb3df800231.tar.gz
rails-4181b677e5164a18fe25767c5bf9eeb3df800231.tar.bz2
rails-4181b677e5164a18fe25767c5bf9eeb3df800231.zip
PostgreSQL 10 allows `CURRENT_DATE` and `CURRENT_TIMESTAMP` as default functions
Address #28797 In the previous versions of PostgreSQL, `CURRENT_DATE` converted to `('now'::text)::date` and `CURRENT_TIMESTAMP` converted to `now()`. Refer these discussions and commit at PostgreSQL : https://www.postgresql.org/message-id/flat/5878.1463098164%40sss.pgh.pa.us#5878.1463098164@sss.pgh.pa.us https://github.com/postgres/postgres/commit/0bb51aa96783e8a6c473c2b5e3725e23e95db834
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 7ae9bd9a5f..370991f2eb 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -561,7 +561,7 @@ module ActiveRecord
end
def has_default_function?(default_value, default)
- !default_value && (%r{\w+\(.*\)|\(.*\)::\w+} === default)
+ !default_value && %r{\w+\(.*\)|\(.*\)::\w+|CURRENT_DATE|CURRENT_TIMESTAMP}.match?(default)
end
def load_additional_types(type_map, oids = nil)