Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

`connection.type_to_sql` returns a `String` for unmapped types.

Closes #13146.

This fixes an error when using:

```
change_colum :table, :column, :bigint, array: true
```
  • Loading branch information...
commit be5527b8e8fcc25946b128fe78db10d5bee2a483 1 parent 7c20a8b
@senny senny authored
View
11 activerecord/CHANGELOG.md
@@ -1,3 +1,14 @@
+* `type_to_sql` returns a `String` for unmapped columns. This fixes an error
+ when using unmapped array types in PG
+
+ Example:
+
+ change_colum :table, :column, :bigint, array: true
+
+ Fixes #13146.
+
+ *Jens Fahnenbruck*, *Yves Senn*
+
@jigfox
jigfox added a note

Thanks for the credit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
* Fix `QueryCache` to work with nested blocks, so that it will only clear the existing cache
after leaving the outer block instead of clearing it right after the inner block is finished.
View
2  activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -690,7 +690,7 @@ def type_to_sql(type, limit = nil, precision = nil, scale = nil) #:nodoc:
column_type_sql
else
- type
+ type.to_s
end
end
View
4 activerecord/test/cases/adapter_test.rb
@@ -178,6 +178,10 @@ def test_select_all_always_return_activerecord_result
result = @connection.select_all "SELECT * FROM posts"
assert result.is_a?(ActiveRecord::Result)
end
+
+ test "type_to_sql returns a String for unmapped types" do
+ assert_equal "special_db_type", @connection.type_to_sql(:special_db_type)
+ end
end
class AdapterTestWithoutTransaction < ActiveRecord::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.