id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc 6566,PostGIS driver: wrong bytea encoding for OFTBinary,jeromeG,warmerdam,"I have a PostGIS table with a column from type ""bytea"" where I want to store an xml file. First, using OGR_F_SetFieldBinary() I write: {{{ }}} then using OGR_F_GetFieldAsBinary() I read it back and get: {{{ }}} I didn't expect the spaces and quotation marks to be encoded! I had a look at the usage of the function GByteArrayToBYTEA in ogrpgdumplayer.cpp of GDAL 2.1. The code seems to generate the following sql statement: {{{ INSERT INTO ... VALUES (..., '', ...) }}} According to https://www.postgresql.org/docs/9.0/static/datatype-binary.html this is no correct. Correct would be either without double ""\"": {{{ INSERT INTO ... VALUES (..., '', ...) }}} or with an ""E"" before: {{{ INSERT INTO ... VALUES (..., E'', ...) }}} This is probably the cause of the problem.",defect,closed,normal,2.0.3,OGR_SF,2.1.0,normal,fixed,"PostGIS, binary, BLOB",