You can just use the data field name BLOB or LONGRAW in your schema. These are both of the type 'bytea' in pgsql. And can be filled with a normal String in upp. Since Strings can contain any raw data(including '\000') this shouldn't provide any problem.