I have a table which has a column of type bytea. I want to update it and set 76th bit as 1. What query should I use ?
1 Answer
To change the 42nd bit to 1, you could use
UPDATE tab
SET binval = set_bit(binval, 41, 1)
WHERE ...
Note that you may be faster with such operations (but waste space) if you change the column to EXTERNAL instead of EXTENDED storage (see the TOAST documentation).
1 Comment
BeginnersSake
Thanks a lot Laurenz