How can I print bytea data as a hexadecimal string in PostgreSQL / pgAdmin III?

Zoltán picture Zoltán · Apr 17, 2013 · Viewed 31.9k times · Source

I have a fairly short (14-byte) bytea data column in my database. I would like to print it as a hexadecimal string.

How do I do that?

Answer

Zoltán picture Zoltán · Apr 17, 2013

Based on this answer, I found my solution to be

SELECT encode(my_column::bytea, 'hex') FROM my_table;