Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DammianMiller/c4df924c5508ebcd599d4034eb137615 to your computer and use it in GitHub Desktop.

Select an option

Save DammianMiller/c4df924c5508ebcd599d4034eb137615 to your computer and use it in GitHub Desktop.
Encode/decode a base64 encoded string in PostGreSQL
-- Decoding
SELECT CONVERT_FROM(DECODE(field, 'BASE64'), 'UTF-8') FROM table;
-- Encoding
SELECT ENCODE(CONVERT_TO(field, 'UTF-8'), 'base64') FROM table;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment