I have a bytea
column that contains text in RisingWave. When I try to cast it to varchar
, I get a hexadecimal output instead of the actual text. How can I convert the bytea
column to varchar
in RisingWave and decode it properly if it is utf-8 encoded?
Neil
Asked on Dec 15, 2023
To convert a bytea
column to varchar
in RisingWave and decode it properly if it is utf-8 encoded, you can use the convert_from
function.
Example:
SELECT convert_from('\x6a6f616e6e61', 'uTF-8');
-- Output: joanna
bytea
column and display it as a varchar
string.