加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Postgresql base64编码

发布时间:2020-12-13 16:04:11 所属栏目:百科 来源:网络整理
导读:我需要将db值转换为base64encode.我试过了: select encode(cast(est_name as text),'base64') from establishments; 它显示错误 [SQL]select encode(string(cast(est_name as text)),'base64') from establishments;[Err] ERROR: function string(text) doe
我需要将db值转换为base64encode.我试过了:

select encode(cast(est_name as text),'base64') from establishments;

它显示错误

[SQL]select encode(string(cast(est_name as text)),'base64') from establishments;

[Err] ERROR:  function string(text) does not exist
LINE 1: select encode(string(cast(est_name as text)),'base64') from ...
                      ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts.

哪里错了?请帮忙.提前致谢

解决方法

编码功能从bytea编码为文本.

select encode(est_name::bytea,'base64') 
from establishments;

http://www.postgresql.org/docs/current/static/functions-binarystring.html#FUNCTIONS-BINARYSTRING-OTHER

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读