[Q] Postgres bytea columns and Marshal load

Hello everyone,

I have a table with a 'bytea' column in Postgres:

  objectdump bytea

I Have an array wich i want to dump in this column:

a = ["Hello", "World"]
data = Marshal.dump(a)

I dump the data:

conn.exec("INSERT INTO my_tab (objectdump) VALUES (#{PGConn.escape_bytea(data)})")

When i try to load the data:

res = conn.exec("SELECT * FROM my_tab")
a2 = Marshal.load(res.getvalue(0,0))

I get the following error:

TypeError: incompatible marshal file format (can't be read)
         format version 4.8 required; 92.48 given

My guess is that something like unescape_bytea is needed.
Any idea?

Thanks in advance,

George Moschovitis


www.navel.gr | tel: +30 2106898050 | fax: +30 2106898437

Navel does not accept liability for any errors, viruses or omissions in the contents of this message. The full corporate policy is available on our site.

have fun: www.joy.gr