{"Entry":{"collection":"func","key":"octet-length","name":"octet_length","aliases":[],"metadata":{"changed_in":["8.1"],"changes":[{"descriptions_changed":true,"doc_overhaul":false,"from":"7.2","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"7.3"},{"descriptions_changed":false,"doc_overhaul":false,"from":"8.0","group_changed":null,"signatures":{"added":["octet_length ( string ) → int"],"removed":["octet_length ( string ) → integer"]},"status":"changed","to":"8.1"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"}],"content_hash":"503df8df84560ee9e38e2ee3441c353d6aaddec0b7540eccb7a0f34529be48b4","first_version":"7.1","group":"string","group_label":"String Functions And Operators","groups":["string","binarystring","bitstring"],"imported_at":"2026-09-27T17:57:28.363592+08:00","last_version":"20","name":"octet_length","name_key":"octet_length","position":3019,"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":"octet_length ( text ) → integer","signature_count":4,"slug":"octet-length","source_rev":"b7bd9cda","summary":"Returns number of bytes in the string.","summary_zh":""}},"Definition":{"Collection":"func","Key":"octet-length","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"octet-length","SourceRevision":"b7bd9cda","Facts":{"description":"Returns number of bytes in the string.","description_html":"Returns number of bytes in the string.","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-STRING-SQL","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"],"prose_only":false,"signatures":[{"description":"Returns number of bytes in the string.","description_html":"Returns number of bytes in the string.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length('josé')","result":"5 (if server encoding is UTF8)"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( text ) → integer","zh_from":""},{"description":"Returns number of bytes in the string. Since this version of the function accepts type character directly, it will not strip trailing spaces.","description_html":"Returns number of bytes in the string. Since this version of the function accepts type \u003ccode class=\"type\"\u003echaracter\u003c/code\u003e directly, it will not strip trailing spaces.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length('abc '::character(4))","result":"4"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003echaracter\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( character ) → integer","zh_from":""},{"description":"Returns number of bytes in the binary string.","description_html":"Returns number of bytes in the binary string.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length('\\x123456'::bytea)","result":"3"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( bytea ) → integer","zh_from":""},{"description":"Returns number of bytes in the bit string.","description_html":"Returns number of bytes in the bit string.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length(B'1011111011')","result":"2"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebit\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( bit ) → integer","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-STRING-SQL","file":"functions-string.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"octet-length","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"octet_length","Summary":"返回字符串的字节数。","BodyHTML":"返回字符串的字节数。\u003cpre\u003eoctet_length ( text ) → integer\u003c/pre\u003e返回字符串的字节数。\u003cpre\u003eoctet_length ( character ) → integer\u003c/pre\u003e返回字符串中的字节数。由于此版本的函数直接接受\u003ccode\u003echaracter\u003c/code\u003e类型，它不会剥离尾随空格。\u003cpre\u003eoctet_length ( bytea ) → integer\u003c/pre\u003e返回二进制字符串中的字节数。\u003cpre\u003eoctet_length ( bit ) → integer\u003c/pre\u003e返回位串中的字节数。","SourceRevision":"ca936764","ContentHash":"acc9a6d98eda0f391f23b6224a2a0ae28d832859779ca2278447b8a417bfb352","Payload":{"description_zh":"返回字符串的字节数。","description_zh_html":"返回字符串的字节数。","signatures":[{"description_zh":"返回字符串的字节数。","description_zh_html":"返回字符串的字节数。","returns":"integer","text":"octet_length ( text ) → integer","zh_from":"doc"},{"description_zh":"返回字符串中的字节数。由于此版本的函数直接接受character类型，它不会剥离尾随空格。","description_zh_html":"返回字符串中的字节数。由于此版本的函数直接接受\u003ccode class=\"type\"\u003echaracter\u003c/code\u003e类型，它不会剥离尾随空格。","returns":"integer","text":"octet_length ( character ) → integer","zh_from":"doc"},{"description_zh":"返回二进制字符串中的字节数。","description_zh_html":"返回二进制字符串中的字节数。","returns":"integer","text":"octet_length ( bytea ) → integer","zh_from":"doc"},{"description_zh":"返回位串中的字节数。","description_zh_html":"返回位串中的字节数。","returns":"integer","text":"octet_length ( bit ) → 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":"05f68b5879694cccb119d805ab403e50568341573bd49088d9996595fdb8c7d8","Text":"octet_length ( text ) → integer","Returns":"integer","Payload":{"description":"Returns number of bytes in the string.","description_html":"Returns number of bytes in the string.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length('josé')","result":"5 (if server encoding is UTF8)"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( text ) → integer","zh_from":""}},{"Version":"18","Ordinal":1,"Hash":"bd226957102281840543ce445439f8b0f364b0b5d7e58f921568f26e37457564","Text":"octet_length ( character ) → integer","Returns":"integer","Payload":{"description":"Returns number of bytes in the string. Since this version of the function accepts type character directly, it will not strip trailing spaces.","description_html":"Returns number of bytes in the string. Since this version of the function accepts type \u003ccode class=\"type\"\u003echaracter\u003c/code\u003e directly, it will not strip trailing spaces.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length('abc '::character(4))","result":"4"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003echaracter\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( character ) → integer","zh_from":""}},{"Version":"18","Ordinal":2,"Hash":"5ae23c2954a537be35da298526c3bbde72ce714f8bd608123af047d01bccf609","Text":"octet_length ( bytea ) → integer","Returns":"integer","Payload":{"description":"Returns number of bytes in the binary string.","description_html":"Returns number of bytes in the binary string.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length('\\x123456'::bytea)","result":"3"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( bytea ) → integer","zh_from":""}},{"Version":"18","Ordinal":3,"Hash":"8476a6235c9a634ad41d368c370d2f4278761ce98e66ddc3df8932f4298f257a","Text":"octet_length ( bit ) → integer","Returns":"integer","Payload":{"description":"Returns number of bytes in the bit string.","description_html":"Returns number of bytes in the bit string.","description_zh":"","description_zh_html":"","examples":[{"expr":"octet_length(B'1011111011')","result":"2"}],"html":"\u003ccode class=\"function\"\u003eoctet_length\u003c/code\u003e ( \u003ccode class=\"type\"\u003ebit\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003einteger\u003c/code\u003e","returns":"integer","text":"octet_length ( bit ) → integer","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
