bytea columns, JDBC and different PostgreSQL versions (8.x - 9.x)
When developing an application that uses a column of type bytea in PostgreSQL, be sure to use the most recent JDBC driver that will be compatible with any PostgreSQL version you are using. A project that worked with PostgreSQL 8.3 when deployed in a server that connects to 9.1, stopped working. Binary data was stored correctly in the database, but when read it appeared as corrupted. Apparently PostgreSQL from 9.0 outputs bytea column data in a new format "hex" instead of the old "escape". Using the most up to date JDBC driver solved the problem.











