I ran the following in psql to flip a bit:
select (b'11' & ~0)
but received this error
ERROR: operator does not exist: bit &
integer
LINE 1: select (b'11' & ~0);
What’s my mistake?
>Solution :
Ensure that both operands are of the same type, bit or integer. Here’s an example:
Using bit operands:
SELECT (B'11'::bit & ~B'0'::bit);
Using integer operands:
SELECT (3 & ~0);
Choose what is better suite for you