AnalyticDB for PostgreSQL is compatible with the binary functions and operators of PostgreSQL. This topic describes the binary functions and operators that are supported by AnalyticDB for PostgreSQL and provides examples on how to use the binary functions and operators.
For information about the binary functions and operators of PostgreSQL, see Binary String Functions and Operators.
Binary string functions and operators
Binary operators are operators that operate on two operands. In computer science, binary operators are used to perform bitwise operations, such as bitwise AND (&), bitwise OR (|), bitwise XOR (^), bitwise NOT (~), left shift (<<), and right shift (>>).
Function | Data type of the return value | Description | Example | Sample result |
|
| Concatenates two strings. |
|
|
|
| Returns the number of bytes in a binary string. |
|
|
|
| Replaces a specific substring in a string with another string. |
|
|
|
| Returns the starting position of a specific substring in a string. |
|
|
|
| Extracts a substring from a string. |
|
|
|
| Removes the longest sequence that contains only the bytes specified by the |
|
|
Binary functions
A binary function is a function that takes two input parameters and returns a result. In programming, binary functions are used to represent algorithms that require two input parameters to return one result.
Function | Data type of the return value | Description | Example | Sample result |
|
| Removes the longest sequence that contains only bytes specified by the |
|
|
|
| Decodes binary data from a textual representation of a string specified by the |
|
|
|
| Encodes binary data into a textual representation. Valid values for the format parameter: |
|
|
|
| Extracts a bit from a string. |
|
|
|
| Extracts a byte from a string. |
|
|
|
| Returns the length of a binary string. |
|
|
|
| Calculates the MD5 hash value of a string specified by the |
|
|
|
| Sets a bit in a string. |
|
|
|
| Sets a byte in a string. |
|
|
|
| Returns the |
|
|
|
| Returns the |
|
|
|
| Returns the |
|
|
|
| Returns the |
|
|