jruby/activerecord-jdbc-adapter — Issue #126: INTEGER[] columns in PostgreSQL are treated as if they were INTEGER columns
Author: yipdw
Created: 2011-11-07 06:03:43+00:00
State: open

Environment:

OS: Ubuntu 11.10, kernel: Linux 3.0.0-12-server #20-Ubuntu SMP Fri Oct 7 16:36:30 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

`java -version`:
java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre10-0ubuntu5)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

`jruby -v`:
jruby 1.6.5 (ruby-1.8.7-p330) (2011-10-25 9dcd388) (OpenJDK 64-Bit Server VM 1.6.0_23) [linux-amd64-java]

`postgres --version`:
postgres (PostgreSQL) 9.1.1

---

The implementation of `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#simplified_type` that ships with ActiveRecord (>= 2.3) returns `:string` for `INTEGER[]` columns.

This same intent appears to be present in ActiveRecord-JDBC's PostgreSQL adapter (see e.g. `lib/arjdbc/postgresql/adapter.rb:45`), but ActiveRecord-JDBC instead returns `:integer`, which corrupts data by coercing the string representation of PostgreSQL arrays to integers.

A test case: https://gist.github.com/1344274