KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a PostgreSQL table that I want to alter a column from bigint to bytea byte to hold more data. I am thinking using the following sequence: alter table mytable add new_column update mytable set new_column = int8send(old_column) alter table drop old_column alter table rename new_column to old_column The above sequence works, the only problem is that I want the byte sequence in the bytea to be reversed . For example, if a value in old_column is 0x1234567890abcdef , the above sequence would generate \0224Vx\220\253\315\357 , but I want it to be \357\315\253\220xV4\022 . Seems like the resulting bytea uses the big-endian order from originating bigint . Is there an easy way to do that without writing a program? I was looking for a swap64() sort of function in PostgreSQL but failed to find one.
Tags (comma-separated)
Save Edits
Cancel