troubleshooting
How to convert bytea column to varchar in RisingWave?
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?
Ne
Neil
Asked on Dec 15, 2023
-
To convert a
bytea
column tovarchar
in RisingWave and decode it properly if it is utf-8 encoded, you can use theconvert_from
function. -
Example:
SELECT convert_from('\x6a6f616e6e61', 'uTF-8');
-- Output: joanna
- This function will decode the utf-8 encoded text from the
bytea
column and display it as avarchar
string.
Dec 15, 2023Edited by