↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / Functions

length

Returns the number of characters in the string.

English manual coverage begins with PostgreSQL 7.1. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

group
string
group label
字符串函数和操作符
lang
en
layout
table-new
pages
functions-string.html, functions-binarystring.html, functions-bitstring.html, functions-geometry.html, functions-textsearch.html
prose only
false

Definition PG 18

Returns the number of characters in the string.

Signatures and overloads

length ( text ) → integer → integer
Returns the number of characters in the string.
length ( bytea ) → integer → integer
Returns the number of bytes in the binary string.
length ( bytes bytea, encoding name ) → integer → integer
Returns the number of characters in the binary string, assuming that it is text in the given encoding.
length ( bit ) → integer → integer
Returns number of bits in the bit string.
length ( geometric_type ) → double precision → double precision
Computes the total length. Available for lseg, path.
length ( tsvector ) → integer → integer
Returns the number of lexemes in the tsvector.

Compare versions

Complete source facts

documentation revision

{"inputs":[{"file":"functions-binarystring.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"cd434063935e362cbb3621171770936b04bafcd58673d71a20cd6992580b2d84","version":"18.7"},{"file":"functions-bitstring.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"270c5c14b6fe519e8d8cc3f7514e0202aa8d534d1e9c8f62ab1ad6802faaa531","version":"18.7"},{"file":"functions-geometry.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"4b9050de67af6b6b8a60d469c4532ce95b56a249d2c61836e447edd2f538f994","version":"18.7"},{"file":"functions-string.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"dbe9f91e55c35969d99a8d2697b6f7bd5388a24ccc2b89706a666f176025f1e2","version":"18.7"},{"file":"functions-textsearch.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"2383d74fd6eee4b71e1b97dec9754623081103120b67a9793f8deac5fff77727","version":"18.7"},{"file":"functions-binarystring.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"a5ee5be3c79e45371853d5c6dd8b1b3f52734bbc17726dbe626837179a1da1e0","version":"18.7"},{"file":"functions-bitstring.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"6b6423f8b2751016eae606a5cdcf7062bd62f230a0ef96b83e357418208bc67e","version":"18.7"},{"file":"functions-geometry.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"3b3f4cdcfdde79ff966b63de649d933c359a402bcc6ddf465dbafd94543ad780","version":"18.7"},{"file":"functions-string.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"7eecd3bb343149124be0476a539f3c682476eab2a15489a0e0ad06fbb769ea9e","version":"18.7"},{"file":"functions-textsearch.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"d8d1661c6d67bb109c5266be16236950471c11d91181aafa96e9055792c4fa78","version":"18.7"}],"release":"18.7","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:41bc1e86b80d2b15f93e3ea873fbca42e2b5eae48f97bb5a74bf78c9fd334c31

Text language: en · wiki-repair-20261023:41bc1e86b80d2b15f93e3ea873fbca42e2b5eae48f97bb5a74bf78c9fd334c31