maybe something like http://www.postgresql.org/docs/devel/static/runtime-config-client.html#GUC-BYTEA-OUTPUT -- does it need to be set to hex? @kennethgillen -- is this something you've had to look into?