Postgres arrays improvements

I have stumbled upon some problems with integer arrays. One of them was this: https://github.com/rails/rails/pull/10340

Error: "undefined method `gsub' for 1:Fixnum" was happening in my *production* app on 4.0.0.beta1 as well as 4.0.0 when updating integer array columns.

The other issue was with multi-dimensional arrays: they did not work with integer array columns.

@Skile9 's commit fixes the first issue, but it was lacking the tests, and it was actualy breaking multidimensional string arrays by accident. So my second commit adds the tests and fixes the regression that could be caused by @Silke9 's patch alone.