Skip to main content
Announcements
Qlik Connect 2025! Join us in Orlando join us for 3 days of immersive learning: REGISTER TODAY

How to get a HEX DUMP of a Postgres STRING?

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
David_Fergen
Former Employee

How to get a HEX DUMP of a Postgres STRING?

Last Update:

Aug 28, 2020 5:43:58 AM

Updated By:

Sonja_Bauernfeind

Created date:

Jul 21, 2020 4:15:21 PM

How to get the HEX DUMP of a Postgres STRING datatype?

 

Answer:

 

To get the HEX DUMP the "encode" function can be used as follows:

 

SELECT "field1", "mystr", encode("mystr"::bytea, 'hex')
FROM "owner"."table1";

 

This will return the HEX DUMP of a STRING field called "mystr". Notice that we cast it as "bytea" and ask the function to return the 'hex' representation.
If you want to return it as 'base64', specify it instead of the 'hex'.

Labels (1)