↑↓ select↵ open⌫ change scopeOpen full search

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

Wiki / Functions

set_bit

Sets n'th bit in binary string to newvalue.

English manual coverage begins with PostgreSQL 7.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

group
binarystring
group label
Binary String Functions And Operators
lang
en
layout
table-new
pages
functions-binarystring.html, functions-bitstring.html
prose only
false

Definition PG 18

Sets n'th bit in binary string to newvalue.

Signatures and overloads

set_bit ( bytes bytea, n bigint, newvalue integer ) → bytea → bytea
Sets n'th bit in binary string to newvalue.
set_bit ( bits bit, n integer, newvalue integer ) → bit → bit
Sets n'th bit in bit string to newvalue; the first (leftmost) bit is bit 0.

Compare versions

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:4822c2a9e410f2955bba120244241413c9c19daccdbaa84472f71501e362d973

Text language: en · wiki-repair-20261023:4822c2a9e410f2955bba120244241413c9c19daccdbaa84472f71501e362d973