Search Shortcut cmd + k | ctrl + k
Search cmd+k ctrl+k
0.10 (stable)
Blob Functions

This section describes functions and operators for examining and manipulating blob values.

Name Description
blob || blob Blob concatenation.
decode(blob) Converts BLOB to VARCHAR. Fails if blob is not valid UTF-8.
encode(string) Converts VARCHAR to BLOB. Converts UTF-8 characters into literal encoding.
octet_length(blob) Number of bytes in BLOB.
read_blob(source) Returns the content from source (a filename, a list of filenames, or a glob pattern) as a BLOB. See the read_blob guide for more details.

blob || blob

Description BLOB concatenation.
Example '\xAA'::BLOB || '\xBB'::BLOB
Result \xAA\xBB

decode(blob)

Description Convert BLOB to VARCHAR. Fails if blob is not valid UTF-8.
Example decode('\xC3\xBC'::BLOB)
Result ü

encode(string)

Description Convert VARCHAR to BLOB. Converts UTF-8 characters into literal encoding.
Example encode('my_string_with_ü')
Result my_string_with_\xC3\xBC

octet_length(blob)

Description Number of bytes in VARCHAR.
Example octet_length('\xAA\xBB'::BLOB)
Result 2

read_blob(source)

Description Returns the content from source (a filename, a list of filenames, or a glob pattern) as a BLOB. See the read_blob guide for more details.
Example read_blob('hello.bin')
Result hello\x0A
About this page

Last modified: 2024-04-18