.png)
Former Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to get a HEX DUMP of a Postgres STRING?
Last Update:
Aug 28, 2020 5:43:58 AM
Updated By:
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'.
12,242 Views