If the final purpose is to get the hexadecimal representation of all the bytes that constitute the strings in textColumn
, this can be done with:
SELECT encode(convert_to(textColumn, 'UTF-8'), 'hex') from tableXY;
It does not depend on bytea_output
. BTW, this setting plays a role only at the final stage of a query, when a result column is of type bytea
and has to be returned in text format to the client (which is the most common case, and what pgAdmin does). It's a matter of representation, the actual values represented (the series of bytes) are identical.
In the query above, the result is of type text
, so this is irrelevant anyway.
I think that your query with decode(..., 'escape')
can't work because the argument is supposed to be encoded in escape
format and it's not, per comments it's normal xml strings.