PostgreSQL - Bitwise Operators

Advertisements


Here are simple examples showing usage of PostgreSQL Bitwise Operators:

testdb=# select 60 | 13;
 ?column?
----------
       61
(1 row)


testdb=# select 60 & 13;
 ?column?
----------
       12
(1 row)


testdb=#  select  (~60);
 ?column?
----------
      -61
(1 row)


testdb=# select  (60 << 2);
 ?column?
----------
      240
(1 row)


testdb=# select  (60 >> 2);
 ?column?
----------
       15
(1 row)


testdb=#  select 60 # 13;
 ?column?
----------
       49
(1 row)


Advertisements
Advertisements