postgresSQL bytea 转text,select 、update方法

//筛选
select *,replace(encode(lanedata::bytea,‘escape’),‘inf’,‘1’)
from mtclanedata
where flag=3 AND laneindex =22936

//修改
update mtclanedata SET lanedata = cast(replace(encode(lanedata::bytea,‘escape’),‘inf’,‘1’) as bytea) where flag=3 AND laneindex =22936

说明:
cast (‘aaa’ as bytea) 将text转为bytea
encode(lanedata::bytea,‘escape’) 将bytea 转为text

你可能感兴趣的:(postgres,BLOB)