{"Entry":{"collection":"func","key":"trim","name":"trim","aliases":[],"metadata":{"changed_in":["7.2","7.4","9.4","14"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"7.1","group_changed":null,"signatures":{"added":["trim ( [both] characters from string ) → bytea"],"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":["trim ( [both] bytes from string ) → bytea"],"removed":["trim ( [both] characters from string ) → bytea"]},"status":"changed","to":"7.4"},{"descriptions_changed":true,"doc_overhaul":false,"from":"9.1","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"9.2"},{"descriptions_changed":false,"doc_overhaul":false,"from":"9.3","group_changed":null,"signatures":{"added":["trim ( [leading | trailing | both] [from] string [, characters] ) → text"],"removed":[]},"status":"changed","to":"9.4"},{"descriptions_changed":false,"doc_overhaul":true,"from":"12","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"changed","to":"13"},{"descriptions_changed":false,"doc_overhaul":false,"from":"13","group_changed":null,"signatures":{"added":["trim ( [ LEADING | TRAILING | BOTH ] bytesremoved bytea FROM bytes bytea ) → bytea","trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] bytes bytea, bytesremoved bytea ) → bytea"],"removed":["trim ( [ BOTH ] bytesremoved bytea FROM bytes bytea ) → bytea","trim ( [ BOTH ] [ FROM ] bytes bytea, bytesremoved bytea ) → bytea"]},"status":"changed","to":"14"}],"content_hash":"0a06653c5f63757c962abbbc31115a93096d0e9922aa9b84d00099ede3695132","first_version":"7.1","group":"string","group_label":"String Functions And Operators","groups":["string","binarystring"],"imported_at":"2026-09-27T17:57:28.455865+08:00","last_version":"20","name":"trim","name_key":"trim","position":3054,"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":"trim ( [ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text ) → text","signature_count":4,"slug":"trim","source_rev":"b7bd9cda","summary":"Removes the longest string containing only characters in characters (a space by default) from the start, end, or both ends (BOTH is the default) of string.","summary_zh":""}},"Definition":{"Collection":"func","Key":"trim","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"trim","SourceRevision":"b7bd9cda","Facts":{"description":"Removes the longest string containing only characters in characters (a space by default) from the start, end, or both ends (BOTH is the default) of string.","description_html":"Removes the longest string containing only characters in \u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e (a space by default) from the start, end, or both ends (\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e is the default) of \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e.","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"],"prose_only":false,"signatures":[{"description":"Removes the longest string containing only characters in characters (a space by default) from the start, end, or both ends (BOTH is the default) of string.","description_html":"Removes the longest string containing only characters in \u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e (a space by default) from the start, end, or both ends (\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e is the default) of \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim(both 'xyz' from 'yxTomxx')","result":"Tom"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e ] \u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"trim ( [ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text ) → text","zh_from":""},{"description":"This is a non-standard syntax for trim().","description_html":"This is a non-standard syntax for \u003ccode class=\"function\"\u003etrim()\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim(both from 'yxTomxx', 'xyz')","result":"Tom"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e\u003c/span\u003e ] \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] string text [, characters text ] ) → text","zh_from":""},{"description":"Removes the longest string containing only bytes appearing in bytesremoved from the start, end, or both ends (BOTH is the default) of bytes.","description_html":"Removes the longest string containing only bytes appearing in \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e from the start, end, or both ends (\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e is the default) of \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim('\\x9012'::bytea from '\\x1234567890'::bytea)","result":"\\x345678"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e \u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ebytea\u003c/code\u003e","returns":"bytea","text":"trim ( [ LEADING | TRAILING | BOTH ] bytesremoved bytea FROM bytes bytea ) → bytea","zh_from":""},{"description":"This is a non-standard syntax for trim().","description_html":"This is a non-standard syntax for \u003ccode class=\"function\"\u003etrim()\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim(both from '\\x1234567890'::bytea, '\\x9012'::bytea)","result":"\\x345678"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e\u003c/span\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\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ebytea\u003c/code\u003e","returns":"bytea","text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] bytes bytea, bytesremoved bytea ) → bytea","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-STRING-SQL","file":"functions-string.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"trim","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"trim","Summary":"从string的开始、末端或两端（默认为BOTH）移除仅包含characters（默认为空格）字符的最长字符串。","BodyHTML":"从\u003cem\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e的开始、末端或两端（默认为\u003ccode\u003eBOTH\u003c/code\u003e）移除仅包含\u003cem\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e（默认为空格）字符的最长字符串。\u003cpre\u003etrim ( [ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text ) → text\u003c/pre\u003e从\u003cem\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e的开始、末端或两端（默认为\u003ccode\u003eBOTH\u003c/code\u003e）移除仅包含\u003cem\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e（默认为空格）字符的最长字符串。\u003cpre\u003etrim ( [ LEADING | TRAILING | BOTH ] [ FROM ] string text [, characters text ] ) → text\u003c/pre\u003e这是一个非标准的\u003ccode\u003etrim()\u003c/code\u003e语法。\u003cpre\u003etrim ( [ LEADING | TRAILING | BOTH ] bytesremoved bytea FROM bytes bytea ) → bytea\u003c/pre\u003e从\u003cem\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e的开头、结尾或两端（默认为\u003ccode\u003eBOTH\u003c/code\u003e）移除仅由\u003cem\u003e\u003ccode\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e中字节组成的最长字符串。\u003cpre\u003etrim ( [ LEADING | TRAILING | BOTH ] [ FROM ] bytes bytea, bytesremoved bytea ) → bytea\u003c/pre\u003e这是一个非标准的\u003ccode\u003etrim()\u003c/code\u003e语法。","SourceRevision":"1b5ca64c","ContentHash":"5eeed16e1f67f0b42bf61b37ee1b2ce784527eefb1c30267b3b08e0005b659e3","Payload":{"description_zh":"从string的开始、末端或两端（默认为BOTH）移除仅包含characters（默认为空格）字符的最长字符串。","description_zh_html":"从\u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e的开始、末端或两端（默认为\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e）移除仅包含\u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e（默认为空格）字符的最长字符串。","signatures":[{"description_zh":"从string的开始、末端或两端（默认为BOTH）移除仅包含characters（默认为空格）字符的最长字符串。","description_zh_html":"从\u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e的开始、末端或两端（默认为\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e）移除仅包含\u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e（默认为空格）字符的最长字符串。","returns":"text","text":"trim ( [ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text ) → text","zh_from":"doc"},{"description_zh":"这是一个非标准的trim()语法。","description_zh_html":"这是一个非标准的\u003ccode class=\"function\"\u003etrim()\u003c/code\u003e语法。","returns":"text","text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] string text [, characters text ] ) → text","zh_from":"doc"},{"description_zh":"从bytes的开头、结尾或两端（默认为BOTH）移除仅由bytesremoved中字节组成的最长字符串。","description_zh_html":"从\u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e的开头、结尾或两端（默认为\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e）移除仅由\u003cem class=\"parameter\"\u003e\u003ccode\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e中字节组成的最长字符串。","returns":"bytea","text":"trim ( [ LEADING | TRAILING | BOTH ] bytesremoved bytea FROM bytes bytea ) → bytea","zh_from":"doc"},{"description_zh":"这是一个非标准的trim()语法。","description_zh_html":"这是一个非标准的\u003ccode class=\"function\"\u003etrim()\u003c/code\u003e语法。","returns":"bytea","text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] bytes bytea, bytesremoved bytea ) → bytea","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":"444bc1cc3f1f32e89c94a78729a91b35f6d2141cbbd5a9fd739709ed33082408","Text":"trim ( [ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text ) → text","Returns":"text","Payload":{"description":"Removes the longest string containing only characters in characters (a space by default) from the start, end, or both ends (BOTH is the default) of string.","description_html":"Removes the longest string containing only characters in \u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e (a space by default) from the start, end, or both ends (\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e is the default) of \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim(both 'xyz' from 'yxTomxx')","result":"Tom"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e ] \u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"trim ( [ LEADING | TRAILING | BOTH ] [ characters text ] FROM string text ) → text","zh_from":""}},{"Version":"18","Ordinal":1,"Hash":"f5e3bc3784e3e5447a3c76e8d6a50fb33a8f80337a9c303f188ab14c9db70a47","Text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] string text [, characters text ] ) → text","Returns":"text","Payload":{"description":"This is a non-standard syntax for trim().","description_html":"This is a non-standard syntax for \u003ccode class=\"function\"\u003etrim()\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim(both from 'yxTomxx', 'xyz')","result":"Tom"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e\u003c/span\u003e ] \u003cem class=\"parameter\"\u003e\u003ccode\u003estring\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003echaracters\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003etext\u003c/code\u003e","returns":"text","text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] string text [, characters text ] ) → text","zh_from":""}},{"Version":"18","Ordinal":2,"Hash":"fa4eeb3df37e4631c9612121185572a89b12036bb082a61fead335d9c64b8541","Text":"trim ( [ LEADING | TRAILING | BOTH ] bytesremoved bytea FROM bytes bytea ) → bytea","Returns":"bytea","Payload":{"description":"Removes the longest string containing only bytes appearing in bytesremoved from the start, end, or both ends (BOTH is the default) of bytes.","description_html":"Removes the longest string containing only bytes appearing in \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e from the start, end, or both ends (\u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e is the default) of \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim('\\x9012'::bytea from '\\x1234567890'::bytea)","result":"\\x345678"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e \u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e \u003cem class=\"parameter\"\u003e\u003ccode\u003ebytes\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ebytea\u003c/code\u003e","returns":"bytea","text":"trim ( [ LEADING | TRAILING | BOTH ] bytesremoved bytea FROM bytes bytea ) → bytea","zh_from":""}},{"Version":"18","Ordinal":3,"Hash":"728121edc514459a8f2b9688859a359732858c9a3659ef7db4b81faacd721ffc","Text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] bytes bytea, bytesremoved bytea ) → bytea","Returns":"bytea","Payload":{"description":"This is a non-standard syntax for trim().","description_html":"This is a non-standard syntax for \u003ccode class=\"function\"\u003etrim()\u003c/code\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"trim(both from '\\x1234567890'::bytea, '\\x9012'::bytea)","result":"\\x345678"}],"html":"\u003ccode class=\"function\"\u003etrim\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eLEADING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eTRAILING\u003c/code\u003e | \u003ccode class=\"literal\"\u003eBOTH\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFROM\u003c/code\u003e\u003c/span\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\u003ebytesremoved\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003ebytea\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003ebytea\u003c/code\u003e","returns":"bytea","text":"trim ( [ LEADING | TRAILING | BOTH ] [ FROM ] bytes bytea, bytesremoved bytea ) → bytea","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
