| PostgreSQL 8.3.23 Documentation | ||||
|---|---|---|---|---|
| Prev | Fast Backward | Chapter 9. Functions and Operators | Fast Forward | Next |
This section describes functions and operators for examining and manipulating values of type bytea.
SQL defines some string functions with a special syntax where certain key words rather than commas are used to separate the arguments. Details are in Table 9-8. Some functions are also implemented using the regular syntax for function invocation. (See Table 9-9.)
Table 9-8. SQL Binary String Functions and Operators
Additional binary string manipulation functions are available and are listed in Table 9-9. Some of them are used internally to implement the SQL-standard string functions listed in Table 9-8.
Table 9-9. Other Binary String Functions
| Function | Return Type | Description | Example | Result |
|---|---|---|---|---|
btrim(string
bytea, bytes bytea) |
bytea | Remove the longest string consisting only of bytes in bytes from the start and end of string | btrim(E'\\000trim\\000'::bytea, E'\\000'::bytea) | trim |
decode(string text,
type text) |
bytea | Decode binary string from string previously encoded with
encode. Parameter type is
same as in encode. |
decode(E'123\\000456', 'escape') | 123\000456 |
encode(string bytea,
type text) |
text | Encode binary string to ASCII-only representation. Supported types are: base64, hex, escape. | encode(E'123\\000456'::bytea, 'escape') | 123\000456 |