I cannot seem to change bytea_output to hex.

I have tried this method:

ALTER DATABASE dbname SET bytea_output TO 'hex';

I have tried to edit postgresql.conf

bytea_output = 'hex'

and restarted the server.

I have tried

SET bytea_output = 'hex'

and it works per transaction, but that is very tedious.

However, whenever I browse my bytea columns in phpPgAdmin, the columns are outputted escaped.


SELECT setting FROM pg_settings WHERE name = 'bytea_output'

returns escape.

How can bytea_output be set permanently to hex?


1 Answer 1


Sounds like PhpPgAdmin is probably doing a session-level SET bytea_output = 'escape'.

If you open a new psql session and SHOW bytea_output; it'll be hex there.

PhpPgAdmin may offer a way to control this behaviour, or it might be hard-coded to work around compatibility issues (if it doesn't understand the hex format for bytea).

  • Yep, you're right. Under Variables, it's escape. It's not in any of the .config files it lists. I think it might be deep in a .php. Oh, well. Thank you so much for your help!
    – user32234
    Jul 2, 2014 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.