Encode binary data to different representation. Supported types are: base64, hex, escape. Escape merely outputs null bytes as \000 and doubles backslashes.
encode(data bytea, type text)
bytea - The String to be encoded
text - Encoding type
text - Returns the Base64 encoded version of bytea.
select encode('base64 encoded string', 'base64');
-----------------------------
YmFzZTY0IGVuY29kZWQgc3RyaW5n