I have to change the value of a determined column in postgre but I never worked before with maskbits, (it's a legacy code). The current value is 1 but it's stored as a integer maskbit so if I try to do
update table set field=0 where ...
It doesn't work and it keeps returning me 1. So I read the documentation and tried to do a AND:
update table set field=field&0 where ...
But it doesn't worked too. Then I tried to cover all the 30 bits, without success too:
update table set field=field&0000000000000000000000000000000 where ...
Can someone please show me how to properly change the value of a integer maskbit on postgresql?
EDIT: I found this case here in StackOverflow
UPDATE users SET permission = permission & ~16
which seen's to be the closest to mine so I tried to do
UPDATE table SET field = field & ~1
because that's the only bit I have to deactivate but it still active and retuning 1 when I do a SELECT