Postgresql array converts to string?


#1

Hi

We are using postgresql with rails, we find out that
when we read array from postresql (postgresql support
array type in table) the rails (or postgresql_adapter)
converts the arrays into Strings, example: we have a
data type array in a table which has two cells:
[cell1,cell2], rails will convert them into string
like this {cell1,cell2}. So after received the result
from a SQL request we have convert the string back to
array, it is very time consuming job.

Does anyone know how to keey the arrays???

we are using ruby1.8.4 and rails 1.0 postgres adapter
version 0.7.1

Thanks you very much

Saiho


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#2

Hi

We are using postgresql with rails, we find out that
when we read array from postresql (postgresql support
array type in table) the rails (or postgresql_adapter)
converts the arrays into Strings, example: we have a
data type array in a table which has two cells:
[cell1,cell2], rails will convert them into string
like this {cell1,cell2}. So after received the result
from a SQL request we have convert the string back to
array, it is very time consuming job.

Does anyone know how to keey the arrays???

we are using ruby1.8.4 and rails 1.0 postgres adapter
version 0.7.1

Thanks you very much

Saiho


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com


#3

Saiho Y. wrote:

array, it is very time consuming job.

I just had a simular problem I used the code
.delete(’{}’).split(’,’)
to convert an integer array.

Regards Neil