Search Shortcut cmd + k | ctrl + k
Search cmd+k ctrl+k
Dark Mode
1.1 (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 the string to BLOB. Converts UTF-8 characters into literal encoding.
hex(blob) Converts blob to VARCHAR using hexadecimal 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 Converts the string to BLOB. Converts UTF-8 characters into literal encoding.
Example encode('my_string_with_ü')
Result my_string_with_\xC3\xBC

hex(blob)

Description Converts blob to VARCHAR using hexadecimal encoding.
Example hex('\xAA\xBB'::BLOB)
Result AABB

octet_length(blob)

Description Number of bytes in blob.
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