Sample Header Ad - 728x90

Reverse Byte-Order of a postgres bytea field

9 votes
8 answers
5620 views
I'm currently working on a table that contains hashes, stored in bytea format. Converting the hashes to hex-strings however yields the wrong order of bytes. Example: SELECT encode(hash, 'hex') FROM mytable LIMIT 1; Output: 1a6ee4de86143e81 Expected: 813e1486dee46e1a Is there a way to reverse the order of bytes for all entries?
Asked by R. Martin (123 rep)
Nov 29, 2016, 07:37 PM
Last activity: Feb 14, 2025, 05:04 AM