I know this is 1/2 off topic, but I think someone here know the answer...

How do I insert data into a blob (bytea) column of a postgresql table?

I've tried inserting using parameters, but it failed:

cur.execute('insert into test_table (id, value) values (?, ?)', 1, data_read_from_a_jpg)

I can't remember the error exactly, but it was about null bytes on the data.

Thanks in advance,