hello, moving from mongo to postgres, I get byte s...
# troubleshooting
m
hello, moving from mongo to postgres, I get byte string representation for UUID datatypes like this:
b'\xab\xb3\x89"\x06\x80C6\x96\xd4&\xa3\x1fA\xc9~'
. How can I convert this to hex representation in postgres? e.g.
abb389220680433696d426a31f41c97e
The python equivalent
foo.hex()
.
this is what I have as text
c
Copy code
SELECT encode(E'\xab\xb3\x89"\x06\x80C6\x96\xd4&\xa3\x1fA\xc9~', 'hex');
m
SELECT encode(E'\xab\xb3\x89"\x06\x80C6\x96\xd4&\xa3\x1fA\xc9~', 'hex');
this returns
ERROR: invalid byte sequence for encoding "UTF8": 0xab
and the strings start with b not E. 😕