PostgresSQL中bytea类型字段更新bytea转text,select、update⽅法PostgresSQL中 bytea类型字段更新 bytea 转text,select 、update⽅法
查询数据
SELECT id_,name_,bytes_,encode(bytes_,'escape')  bytes_text,
replace(encode(bytes_,'escape'),'902924','13513801')::bytea bytes_bytea
FROM act_ge_bytearray
where name_ ~*'新增'
修改bytea
update act_ge_bytearray
set bytes_=replace(encode(bytes_,'escape'),'902924','13513801')::bytea
where name_ ~*'新增'
and encode(bytes_,'escape')~*'902924'
转换说明
cast (‘bytes_text’ as bytea) 将text转为bytea
‘bytes_text’ ::bytea 将text转为bytea
sql中select是什么意思encode(bytes_text::bytea,‘escape’) 将bytea 转为text

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。