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.
| Operator | Signature | Description | Example | Result |
|---|---|---|---|---|
|| | bit || bit → bit | Concatenates two bit strings. | B'10001' || B'011' | 10001011 |
& | bit & bit → bit | Returns the bitwise AND of two bit strings. | B'10001' & B'01101' | 00001 |
| | bit | bit → bit | Returns the bitwise OR of two bit strings. | B'10001' | B'01101' | 11101 |
# | bit # bit → bit | Returns the bitwise XOR of two bit strings. | B'10001' # B'01101' | 11100 |
~ | ~ bit → bit | Returns the bitwise NOT. | ~ B'10001' | 01110 |
<< | bit << integer → bit | Shifts bits left by N positions. The string length is preserved; vacant positions are filled with zeros. | B'10001' << 3 | 01000 |
>> | bit >> integer → bit | Shifts bits right by N positions. The string length is preserved; vacant positions are filled with zeros. | B'10001' >> 2 | 00100 |
该文章对您有帮助吗?