title: PostgreSQL bytea to Base64 like SQL Server
body: <p>In SQL Server I convert binary to Base64 like this</p>
  
  <pre><code>SELECT HASHBYTES('MD5', 'Test') FOR XML PATH(''), TYPE
  </code></pre>
  
  <p>and have result "DLxmEfVUC9CAmjiNyVphWw==".</p>
  
  <p>In PostgreSQL i have</p>
  
  <pre><code>SELECT encode(md5('Test')::bytea, 'base64')
  </code></pre>
  
  <p>and result is "MGNiYzY2MTFmNTU0MGJkMDgwOWEzODhkYzk1YTYxNWI=".</p>
  
  <p>How can I get result like SQL Server?</p>