[Q] Postgres bytea columns and Marshal load

G

George Moschovitis

Hello everyone,

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

CREATE TABLE my_tab {
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top