【openGauss】openGauss表中字段类型bytea和blob互相转换
一、bytea转blob
语法:rawout(t.bytes_)::text::raw::blob
select rawout(t.bytes_)::text::raw::blob as s1 -- bytea转blob
,rawin(rawout(t.bytes_)::text::raw::blob::raw::text::cstring) as s2
,t.bytes_
,t.*
from tzq_log_t t
limit 10;
二、blob转bytea
语法:rawin(t.bytes_::raw::text::cstring)
select rawout(t.bytes_)::text::raw::blob as s1
-- blob转bytea
,rawin(rawout(t.bytes_)::text::raw::blob::raw::text::cstring) as s2
,t.bytes_
,t.*
from tzq_log_t t
limit 10;