↑↓ select ↵ open ⌫ change scope Open full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Functions / String Functions And Operators

Returns number of bits in the string (8 times the octet_length).

Reading PG 18current·documented in 26 of 27 versions, 7.2 to 20

Signatures & examples

bit_length ( text ) → integer
Returns number of bits in the string (8 times the octet_length).
bit_length('jose') → 32
bit_length ( bytea ) → integer
Returns number of bits in the binary string (8 times the octet_length).
bit_length('\x123456'::bytea) → 24
bit_length ( bit ) → integer
Returns number of bits in the bit string.
bit_length(B'10111') → 5
Version history 4
  1. 12 → 13 changed
  2. 8.0 → 8.1 changed
  3. 7.2 → 7.3 changed
  4. 7.1 → 7.2 added

Definition snapshot: b7bd9cda · English manual source