bit_or()

A function which returns the bitwise OR of all bits in the provided parameter

bit_or() is a is a system function which returns the bitwise OR of all bits in the provided parameter.

bit_or() was added in PostgreSQL 8.0.

Usage

bit_or ( smallint ) → smallint

bit_or ( integer ) → integer

bit_or ( bigint ) → bigint

bit_or ( bit ) → bit

Change history

Examples

Basic example for bit_or():

postgres=# CREATE TABLE foo (x INT);
CREATE TABLE

postgres=# INSERT INTO foo VALUES(100),(110),(111);
INSERT 0 3

postgres=# SELECT bit_and(x), bit_or(x), bit_xor(x) FROM foo;
 bit_and | bit_or | bit_xor 
---------+--------+---------
     100 |    111 |     101

Categories

System function