aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authornanaya <me@myconan.net>2016-08-18 21:56:15 +0900
committernanaya <me@myconan.net>2016-09-01 14:06:35 +0900
commit4c2f7ee36a623090d276ef811d959adb0ecff743 (patch)
tree9df064414cd43d0fb6c2d6f65588014695261091 /activerecord/lib/active_record
parent501e979e186a3861581aa54f9930421223688d01 (diff)
downloadrails-4c2f7ee36a623090d276ef811d959adb0ecff743.tar.gz
rails-4c2f7ee36a623090d276ef811d959adb0ecff743.tar.bz2
rails-4c2f7ee36a623090d276ef811d959adb0ecff743.zip
Fix case insensitive check for text column in pg
There's no 'text to text' casting in the cast table so the feature detection fails.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
index 08c81e7478..c9a0287bca 100644
--- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
+++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
@@ -771,6 +771,10 @@ module ActiveRecord
sql = <<-end_sql
SELECT exists(
SELECT * FROM pg_proc
+ WHERE proname = 'lower'
+ AND proargtypes = ARRAY[#{quote column.sql_type}::regtype]::oidvector
+ ) OR exists(
+ SELECT * FROM pg_proc
INNER JOIN pg_cast
ON ARRAY[casttarget]::oidvector = proargtypes
WHERE proname = 'lower'