Skip to main content

Bitstring Type

NameAliasesDescription
BITBITSTRINGvariable-length strings of 1's and 0's

Bitstrings are strings of 1's and 0's. The bit type data is of variable length. A bitstring value requires 1 byte for each group of 8 bits, plus a fixed amount to store some metadata.

By default bitstrings will not be padded with zeroes. Bitstrings can be very large, having the same size restrictions as BLOBs.

-- create a bitstring 
SELECT '101010'::BIT
-- create a bitstring with predefined length
-- the resulting bitstring will be left-padded with zeroes. This returns 000000101011
SELECT bitstring('0101011', 12);

Functions

See Bitstring Functions.