diff options
author | Matthew Draper <matthew@trebex.net> | 2016-10-11 12:20:26 +1030 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2016-10-11 12:23:15 +1030 |
commit | bc9dc418259f1db0f14ed895e8469b7839ef474b (patch) | |
tree | 8020fd7fe2e27ff94b28039ba47e8f2d076ee755 /activerecord/lib/active_record | |
parent | 469dd36af14ec20197910fb5cd2fd47f7612ef09 (diff) | |
parent | 4c2f7ee36a623090d276ef811d959adb0ecff743 (diff) | |
download | rails-bc9dc418259f1db0f14ed895e8469b7839ef474b.tar.gz rails-bc9dc418259f1db0f14ed895e8469b7839ef474b.tar.bz2 rails-bc9dc418259f1db0f14ed895e8469b7839ef474b.zip |
Merge pull request #26208 from nanaya/pg-insensitive-text
Fix case insensitive check for text column in pg
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb index 8001c0dd53..a33e64883e 100644 --- a/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +++ b/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb @@ -771,10 +771,14 @@ 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 casttarget::text::oidvector = proargtypes + ON ARRAY[casttarget]::oidvector = proargtypes WHERE proname = 'lower' - AND castsource = '#{column.sql_type}'::regtype::oid + AND castsource = #{quote column.sql_type}::regtype ) end_sql execute_and_clear(sql, "SCHEMA", []) do |result| |