Page 1 of 1

[SOLVED] How to insert binary data into Postgresql?

Posted: Wed Nov 24, 2004 11:38 pm
by myleow
I have a HTTP_RAW_POST_DATA from a cell phone in WBXML encoding and i want to store it into the database. I created the column with BYTEA datatype since i know none of the raw data would exceed 1 GB, in fact it won't exceed 10k.

Anyway i am getting problem inserting using regular INSERT INTO because of the special characters ' \ that might be present in the RAW DATA.

I tried casting the data into bytea type using $data::bytea but that didn't help at all.

Anyone dealt with this situation before care to enlighten me please.

Regards
Mian

EDIT: pg_escape_bytea