如何在 PostgreSQL / pgAdmin III 中将 bytea 数据打印为十六进制字符串?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16055849/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 00:08:40  来源:igfitidea点击:

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

postgresqlhexpgadmin

提问by Zoltán

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

我的数据库中有一个相当短(14 字节)的bytea数据列。我想将其打印为十六进制字符串。

How do I do that?

我怎么做?

回答by Zoltán

Based on this answer, I found my solution to be

基于这个答案,我发现我的解决方案是

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