pgweb
pgweb copied to clipboard
Display bytea columns hex encoded
Currently (on 0.9.4) the content of bytea columns is shown as a UTF-8 string in the table view. It would be nice if these columns could be shown using hex encoding instead.
The encoding can be done in postgres using:
SELECT encode(my_checksum, 'hex') FROM my_table;
But this kind of behavior would require the server to keep tabs on types of fields used in each table. I understand that it will be a much nicer user experience, but i dont really have the time to work on something like this. If you have any suggestions / code snippets i would definitely help getting the feature added, but otherwise i'll leave this issue open.
I'm not familiar with go, but would it be easier to do the hex encoding in go?
If it's possible to reflect on the result's column type to see if it's a Bytea, it should be possible to encode it using something like hex.EncodeToString().
This is now supported with --binary-codec= option.
--binary-codec= Codec for binary data serialization, one of 'none', 'hex', 'base58', 'base64' (default: none)