In software systems it is often the early bird that makes the worm.

(Alan Perlis )

icon Blog Detail

PostgreSQL 9 bytea type problems

  • Posted: Oct 11, 2013 /
  • By: Admin /
  • Reads : 1,246

 The column type was bytea, which is basically a variable length binary string. The problem turned out to be that, for this specific data type (bytea), the output representation of PostgreSQL 9  is different from previous versions. PostgreSQL 9 introduced a new 'hex' format for output, this format is different from the old 'escape' format that older versions of PostgreSQL used to provide. That was the problem, we save data in the database, expect it to be in 'escape' format when retrieved, but we get it in 'hex' format.

The solution is rather simple, tell PostgreSQL to return data in the old, familiar 'escape' format. This can be achieved using the following code

 ALTER DATABASE database_name SET bytea_output TO 'escape';


Headstart your career with us

Find out more about current openings at Rhino Technology