提交 1f6a9b50 编写于 作者: D Damien Mathieu

fix quoting non-strings

Closes #13444
上级 7432d32f
......@@ -144,7 +144,7 @@ def escape_hstore(value)
def quote_and_escape(value)
case value
when "NULL"
when "NULL", Numeric
value
else
"\"#{value.gsub(/"/,"\\\"")}\""
......
......@@ -66,6 +66,12 @@ def test_type_cast_array
assert_equal([nil], @column.type_cast('{NULL}'))
end
def test_type_cast_integers
x = PgArray.new(ratings: ['1', '2'])
assert x.save!
assert_equal(['1', '2'], x.ratings)
end
def test_rewrite
@connection.execute "insert into pg_arrays (tags) VALUES ('{1,2,3}')"
x = PgArray.first
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册