PostgreSQL encode()

Encode binary data to different representation. Supported types are: base64, hex, escape. Escape merely outputs null bytes as \000 and doubles backslashes.

Function

encode(data bytea, type text)

Parameters

bytea - The String to be encoded
text - Encoding type

Return value

text - Returns the Base64 encoded version of bytea.

Example

select encode('base64 encoded string', 'base64');
-----------------------------
YmFzZTY0IGVuY29kZWQgc3RyaW5n

Github

See also: