Bit string functions and operators

更新时间:
复制 MD 格式

AnalyticDB for PostgreSQL supports the bit string functions and operators defined in PostgreSQL 12. For the full list of supported functions, see Bit String Functions and Operators in the PostgreSQL documentation.

Bit string operators

The following table lists the supported bit string operators.

OperatorSignatureDescriptionExampleResult
||bit || bit → bitConcatenates two bit strings.B'10001' || B'011'10001011
&bit & bit → bitReturns the bitwise AND of two bit strings.B'10001' & B'01101'00001
|bit | bit → bitReturns the bitwise OR of two bit strings.B'10001' | B'01101'11101
#bit # bit → bitReturns the bitwise XOR of two bit strings.B'10001' # B'01101'11100
~~ bit → bitReturns the bitwise NOT.~ B'10001'01110
<<bit << integer → bitShifts bits left by N positions. The string length is preserved; vacant positions are filled with zeros.B'10001' << 301000
>>bit >> integer → bitShifts bits right by N positions. The string length is preserved; vacant positions are filled with zeros.B'10001' >> 200100