{"Entry":{"collection":"func","key":"length","name":"length","aliases":[],"metadata":{"changed_in":["7.2","8.0","8.1","8.2","8.3","9.1"],"changes":[{"descriptions_changed":true,"doc_overhaul":false,"from":"7.1","group_changed":{"from":"geometry","to":"string"},"signatures":{"added":["length ( string ) → integer"],"removed":[]},"status":"changed","to":"7.2"},{"descriptions_changed":true,"doc_overhaul":false,"from":"7.2","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"7.3"},{"descriptions_changed":true,"doc_overhaul":false,"from":"7.3","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"7.4"},{"descriptions_changed":false,"doc_overhaul":false,"from":"7.4","group_changed":null,"signatures":{"added":["length ( string text ) → integer"],"removed":[]},"status":"changed","to":"8.0"},{"descriptions_changed":false,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":["length ( string text ) → int","length ( string ) → int"],"removed":["length ( string text ) → integer","length ( string ) → integer"]},"status":"changed","to":"8.1"},{"descriptions_changed":false,"doc_overhaul":false,"from":"8.1","group_changed":null,"signatures":{"added":[],"removed":["length ( string text ) → int"]},"status":"changed","to":"8.2"},{"descriptions_changed":false,"doc_overhaul":false,"from":"8.2","group_changed":null,"signatures":{"added":["length ( stringbytea, encoding name ) → int","length ( tsvector ) → integer"],"removed":[]},"status":"changed","to":"8.3"},{"descriptions_changed":false,"doc_overhaul":false,"from":"9.0","group_changed":null,"signatures":{"added":["length ( string bytea, encoding name ) → int"],"removed":["length ( stringbytea, encoding name ) → int"]},"status":"changed","to":"9.1"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"aa5db52dd9430cf7c8c98f1560872bd10729a3da7396e4dcb35d31aabee931aa","first_version":"7.1","group":"string","group_label":"String Functions And Operators","groups":["string","binarystring","bitstring","geometry","textsearch"],"imported_at":"2026-09-27T17:57:28.343032+08:00","last_version":"20","name":"length","name_key":"length","position":3013,"present_in":["7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"signature":"length ( text ) → integer","signature_count":6,"slug":"length","source_rev":"b7bd9cda","summary":"Returns the number of characters in the string.","summary_zh":""}},"Definition":{"Collection":"func","Key":"length","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"length","SourceRevision":"b7bd9cda","Facts":{"description":"Returns the number of characters in the string.","description_html":"Returns the number of characters in the string.","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-STRING-OTHER","file":"functions-string.html","slug":"18"},"group":"string","group_label":"String Functions And Operators","lang":"en","layout":"table-new","pages":["functions-string.html","functions-binarystring.html","functions-bitstring.html","functions-geometry.html","functions-textsearch.html"],"prose_only":false,"signatures":[{"description":"Returns the number of characters in the string.","description_html":"Returns the number of characters in the string.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('jose')","result":"4"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( text ) → integer","zh_from":""},{"description":"Returns the number of bytes in the binary string.","description_html":"Returns the number of bytes in the binary string.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('\\x1234567890'::bytea)","result":"5"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( bytea ) → integer","zh_from":""},{"description":"Returns the number of characters in the binary string, assuming that it is text in the given encoding.","description_html":"Returns the number of characters in the binary string, assuming that it is text in the given \u003cem class=\"parameter\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('jose'::bytea, 'UTF8')","result":"4"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ename\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( bytes bytea, encoding name ) → integer","zh_from":""},{"description":"Returns number of bits in the bit string.","description_html":"Returns number of bits in the bit string.","description_zh":"","description_zh_html":"","examples":[{"expr":"length(B'10111')","result":"5"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebit\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( bit ) → integer","zh_from":""},{"description":"Computes the total length. Available for lseg, path.","description_html":"Computes the total length. Available for \u003ccode class=\"type\"\u003elseg\u003c/code\u003e, \u003ccode class=\"type\"\u003epath\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"length(path '((-1,0),(1,0))')","result":"4"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003egeometric_type\u003c/code\u003e\u003c/em\u003e ) → \u003ccode class=\"returnvalue\"\u003edouble precision\u003c/code\u003e","returns":"double precision","text":"length ( geometric_type ) → double precision","zh_from":""},{"description":"Returns the number of lexemes in the tsvector.","description_html":"Returns the number of lexemes in the \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('fat:2,4 cat:3 rat:5A'::tsvector)","result":"3"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( tsvector ) → integer","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-STRING-OTHER","file":"functions-string.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"length","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"length","Summary":"返回字符串中的字符数。","BodyHTML":"返回字符串中的字符数。\u003cpre\u003elength ( text ) → integer\u003c/pre\u003e返回字符串中的字符数。\u003cpre\u003elength ( bytea ) → integer\u003c/pre\u003e返回二进制字符串中的字节数。\u003cpre\u003elength ( bytes bytea, encoding name ) → integer\u003c/pre\u003e返回二进制字符串中的字符数，假设它是给定\u003cem\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e中的文本。\u003cpre\u003elength ( bit ) → integer\u003c/pre\u003e返回位串中的位数。\u003cpre\u003elength ( geometric_type ) → double precision\u003c/pre\u003e计算总长度。适用于 \u003ccode\u003elseg\u003c/code\u003e、\u003ccode\u003epath\u003c/code\u003e。\u003cpre\u003elength ( tsvector ) → integer\u003c/pre\u003e返回\u003ccode\u003etsvector\u003c/code\u003e中的词位数。","SourceRevision":"ca936764","ContentHash":"12e59975718f6ee146198d5d7d5ada86bcbdd6e9a60361cf52b93a403b0fec1c","Payload":{"description_zh":"返回字符串中的字符数。","description_zh_html":"返回字符串中的字符数。","signatures":[{"description_zh":"返回字符串中的字符数。","description_zh_html":"返回字符串中的字符数。","returns":"integer","text":"length ( text ) → integer","zh_from":"doc"},{"description_zh":"返回二进制字符串中的字节数。","description_zh_html":"返回二进制字符串中的字节数。","returns":"integer","text":"length ( bytea ) → integer","zh_from":"doc"},{"description_zh":"返回二进制字符串中的字符数，假设它是给定encoding中的文本。","description_zh_html":"返回二进制字符串中的字符数，假设它是给定\u003cem class=\"parameter\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e中的文本。","returns":"integer","text":"length ( bytes bytea, encoding name ) → integer","zh_from":"doc"},{"description_zh":"返回位串中的位数。","description_zh_html":"返回位串中的位数。","returns":"integer","text":"length ( bit ) → integer","zh_from":"doc"},{"description_zh":"计算总长度。适用于 lseg、path。","description_zh_html":"计算总长度。适用于 \u003ccode class=\"type\"\u003elseg\u003c/code\u003e、\u003ccode class=\"type\"\u003epath\u003c/code\u003e。","returns":"double precision","text":"length ( geometric_type ) → double precision","zh_from":"doc"},{"description_zh":"返回tsvector中的词位数。","description_zh_html":"返回\u003ccode class=\"type\"\u003etsvector\u003c/code\u003e中的词位数。","returns":"integer","text":"length ( tsvector ) → integer","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","7.1","7.2","7.3","7.4","8.0","8.1","8.2","8.3","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"31b9ce7ee9cb2f3621c337bfb47569c9156168f257544b175c00382dc6ab0ac1","Text":"length ( text ) → integer","Returns":"integer","Payload":{"description":"Returns the number of characters in the string.","description_html":"Returns the number of characters in the string.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('jose')","result":"4"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( text ) → integer","zh_from":""}},{"Version":"18","Ordinal":1,"Hash":"fe430c23f2a8871216b2c9dcaa8a38f586a59780e5e87d168f4f5d7b5a82e882","Text":"length ( bytea ) → integer","Returns":"integer","Payload":{"description":"Returns the number of bytes in the binary string.","description_html":"Returns the number of bytes in the binary string.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('\\x1234567890'::bytea)","result":"5"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( bytea ) → integer","zh_from":""}},{"Version":"18","Ordinal":2,"Hash":"b2c2236693efb44f0edccf60f5229053c279505ddba2efe3075f72b54411c694","Text":"length ( bytes bytea, encoding name ) → integer","Returns":"integer","Payload":{"description":"Returns the number of characters in the binary string, assuming that it is text in the given encoding.","description_html":"Returns the number of characters in the binary string, assuming that it is text in the given \u003cem class=\"parameter\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('jose'::bytea, 'UTF8')","result":"4"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eencoding\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ename\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( bytes bytea, encoding name ) → integer","zh_from":""}},{"Version":"18","Ordinal":3,"Hash":"0e94187beac774e3fd9be14369a14e18966f39308441c69b0054bdda5dbf8f63","Text":"length ( bit ) → integer","Returns":"integer","Payload":{"description":"Returns number of bits in the bit string.","description_html":"Returns number of bits in the bit string.","description_zh":"","description_zh_html":"","examples":[{"expr":"length(B'10111')","result":"5"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebit\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( bit ) → integer","zh_from":""}},{"Version":"18","Ordinal":4,"Hash":"ef7ec61f501ca269705299f037ec4623cd909694665601da6c08f4b391d7fde6","Text":"length ( geometric_type ) → double precision","Returns":"double precision","Payload":{"description":"Computes the total length. Available for lseg, path.","description_html":"Computes the total length. Available for \u003ccode class=\"type\"\u003elseg\u003c/code\u003e, \u003ccode class=\"type\"\u003epath\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"length(path '((-1,0),(1,0))')","result":"4"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003cem class=\"replaceable\"\u003e\u003ccode\u003egeometric_type\u003c/code\u003e\u003c/em\u003e ) → \u003ccode class=\"returnvalue\"\u003edouble precision\u003c/code\u003e","returns":"double precision","text":"length ( geometric_type ) → double precision","zh_from":""}},{"Version":"18","Ordinal":5,"Hash":"e68178e5ad541c630e959d8e9c1834fbc7f2aae2e479b38f3d0b21d8dc990d45","Text":"length ( tsvector ) → integer","Returns":"integer","Payload":{"description":"Returns the number of lexemes in the tsvector.","description_html":"Returns the number of lexemes in the \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"length('fat:2,4 cat:3 rat:5A'::tsvector)","result":"3"}],"html":"\u003ccode class=\"function\"\u003elength\u003c/code\u003e ( \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"length ( tsvector ) → integer","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
