{"Entry":{"collection":"func","key":"unnest","name":"unnest","aliases":[],"metadata":{"changed_in":["9.4","9.6","14"],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"8.3","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"8.4"},{"descriptions_changed":false,"doc_overhaul":false,"from":"9.3","group_changed":null,"signatures":{"added":["unnest ( anyarray, anyarray [, ...] ) → setof anyelement, anyelement [, ...]"],"removed":[]},"status":"changed","to":"9.4"},{"descriptions_changed":true,"doc_overhaul":false,"from":"9.5","group_changed":{"from":"array","to":"textsearch"},"signatures":{"added":["unnest ( tsvector, OUT lexeme text, OUT positions smallint[], OUT weights text ) → setof record"],"removed":[]},"status":"changed","to":"9.6"},{"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":["unnest ( anymultirange ) → setof anyrange"],"removed":[]},"status":"changed","to":"14"}],"content_hash":"257075bdaf73ab75691428fbe050261b539f3c216f906163be385b45f9d335a3","first_version":"8.4","group":"textsearch","group_label":"Text Search Functions And Operators","groups":["textsearch","array","range"],"imported_at":"2026-09-27T17:57:28.745894+08:00","last_version":"20","name":"unnest","name_key":"unnest","position":12025,"present_in":["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":"unnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text )","signature_count":4,"slug":"unnest","source_rev":"b7bd9cda","summary":"Expands a tsvector into a set of rows, one per lexeme.","summary_zh":""}},"Definition":{"Collection":"func","Key":"unnest","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"unnest","SourceRevision":"b7bd9cda","Facts":{"description":"Expands a tsvector into a set of rows, one per lexeme.","description_html":"Expands a \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e into a set of rows, one per lexeme.","description_zh":"","description_zh_html":"","doc":{"anchor":"TEXTSEARCH-FUNCTIONS-TABLE","file":"functions-textsearch.html","slug":"18"},"group":"textsearch","group_label":"Text Search Functions And Operators","lang":"en","layout":"table-new","pages":["functions-textsearch.html","functions-array.html","functions-range.html"],"prose_only":false,"signatures":[{"description":"Expands a tsvector into a set of rows, one per lexeme.","description_html":"Expands a \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e into a set of rows, one per lexeme.","description_zh":"","description_zh_html":"","examples":[{"expr":"select * from unnest('cat:3 fat:2,4 rat:5A'::tsvector)","result":" lexeme | positions | weights\n--------+-----------+---------\n cat    | {3}       | {D}\n fat    | {2,4}     | {D,D}\n rat    | {5}       | {A}"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003esetof record\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003elexeme\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epositions\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003esmallint[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eweights\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e )","returns":"setof record","text":"unnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text )","zh_from":""},{"description":"Expands an array into a set of rows. The array's elements are read out in storage order.","description_html":"Expands an array into a set of rows. The array's elements are read out in storage order.","description_zh":"","description_zh_html":"","examples":[{"expr":"unnest(ARRAY[1,2])","result":"1\n2"},{"expr":"unnest(ARRAY[['foo','bar'],['baz','quux']])","result":"foo\nbar\nbaz\nquux"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanyarray\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003esetof anyelement\u003c/code\u003e","returns":"setof anyelement","text":"unnest ( anyarray ) → setof anyelement","zh_from":""},{"description":"Expands multiple arrays (possibly of different data types) into a set of rows. If the arrays are not all the same length then the shorter ones are padded with NULLs. This form is only allowed in a query's FROM clause; see Section 7.2.1.4.","description_html":"Expands multiple arrays (possibly of different data types) into a set of rows. If the arrays are not all the same length then the shorter ones are padded with \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003es. This form is only allowed in a query's FROM clause; see \u003ca href=\"/docs/18/queries-table-expressions.html#QUERIES-TABLEFUNCTIONS\" title=\"7.2.1.4. Table Functions\"\u003eSection 7.2.1.4\u003c/a\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"select * from unnest(ARRAY[1,2], ARRAY['foo','bar','baz']) as x(a,b)","result":" a |  b\n---+-----\n 1 | foo\n 2 | bar\n   | baz"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanyarray\u003c/code\u003e, \u003ccode class=\"type\"\u003eanyarray\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, ...\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003esetof anyelement, anyelement [, ... ]\u003c/code\u003e","returns":"setof anyelement, anyelement [, ... ]","text":"unnest ( anyarray, anyarray [, ... ] ) → setof anyelement, anyelement [, ... ]","zh_from":""},{"description":"Expands a multirange into a set of ranges in ascending order.","description_html":"Expands a multirange into a set of ranges in ascending order.","description_zh":"","description_zh_html":"","examples":[{"expr":"unnest('{[1,2), [3,4)}'::int4multirange)","result":"[1,2)\n[3,4)"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanymultirange\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003esetof anyrange\u003c/code\u003e","returns":"setof anyrange","text":"unnest ( anymultirange ) → setof anyrange","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"TEXTSEARCH-FUNCTIONS-TABLE","file":"functions-textsearch.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"unnest","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"unnest","Summary":"将tsvector展开为一组行，每行对应一个词位。","BodyHTML":"将\u003ccode\u003etsvector\u003c/code\u003e展开为一组行，每行对应一个词位。\u003cpre\u003eunnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text )\u003c/pre\u003e将\u003ccode\u003etsvector\u003c/code\u003e展开为一组行，每行对应一个词位。\u003cpre\u003eunnest ( anyarray ) → setof anyelement\u003c/pre\u003e将数组展开到一组行。数组的元素按存储顺序读出。\u003cpre\u003eunnest ( anyarray, anyarray [, ... ] ) → setof anyelement, anyelement [, ... ]\u003c/pre\u003e将多个数组（可能是不同的数据类型）展开到一组行中。如果数组的长度不完全相同，那么较短的数组将用\u003ccode\u003eNULL\u003c/code\u003e填充。这种形式只允许出现在查询的 FROM 子句中；参见\u003ca href=\"/docs/18/queries-table-expressions.html#QUERIES-TABLEFUNCTIONS\" rel=\"nofollow\"\u003e第 7.2.1.4 节\u003c/a\u003e。\u003cpre\u003eunnest ( anymultirange ) → setof anyrange\u003c/pre\u003e将多范围按升序展开为一组范围。","SourceRevision":"1b5ca64c","ContentHash":"31e062f5e30e868d92eddbcbd4e7401419fc479d669f36ea17f54adf7b0eb9db","Payload":{"description_zh":"将tsvector展开为一组行，每行对应一个词位。","description_zh_html":"将\u003ccode class=\"type\"\u003etsvector\u003c/code\u003e展开为一组行，每行对应一个词位。","signatures":[{"description_zh":"将tsvector展开为一组行，每行对应一个词位。","description_zh_html":"将\u003ccode class=\"type\"\u003etsvector\u003c/code\u003e展开为一组行，每行对应一个词位。","returns":"setof record","text":"unnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text )","zh_from":"doc"},{"description_zh":"将数组展开到一组行。数组的元素按存储顺序读出。","description_zh_html":"将数组展开到一组行。数组的元素按存储顺序读出。","returns":"setof anyelement","text":"unnest ( anyarray ) → setof anyelement","zh_from":"doc"},{"description_zh":"将多个数组（可能是不同的数据类型）展开到一组行中。如果数组的长度不完全相同，那么较短的数组将用NULL填充。这种形式只允许出现在查询的 FROM 子句中；参见第 7.2.1.4 节。","description_zh_html":"将多个数组（可能是不同的数据类型）展开到一组行中。如果数组的长度不完全相同，那么较短的数组将用\u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e填充。这种形式只允许出现在查询的 FROM 子句中；参见\u003ca href=\"/docs/18/queries-table-expressions.html#QUERIES-TABLEFUNCTIONS\" title=\"7.2.1.4. 表函数\"\u003e第 7.2.1.4 节\u003c/a\u003e。","returns":"setof anyelement, anyelement [, ... ]","text":"unnest ( anyarray, anyarray [, ... ] ) → setof anyelement, anyelement [, ... ]","zh_from":"doc"},{"description_zh":"将多范围按升序展开为一组范围。","description_zh_html":"将多范围按升序展开为一组范围。","returns":"setof anyrange","text":"unnest ( anymultirange ) → setof anyrange","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","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":"b991fdf576a29557c8bd347b053fa13769be5c5c870c1c0e1c7f4b5776f62ca6","Text":"unnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text )","Returns":"setof record","Payload":{"description":"Expands a tsvector into a set of rows, one per lexeme.","description_html":"Expands a \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e into a set of rows, one per lexeme.","description_zh":"","description_zh_html":"","examples":[{"expr":"select * from unnest('cat:3 fat:2,4 rat:5A'::tsvector)","result":" lexeme | positions | weights\n--------+-----------+---------\n cat    | {3}       | {D}\n fat    | {2,4}     | {D,D}\n rat    | {5}       | {A}"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003etsvector\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003esetof record\u003c/code\u003e ( \u003cem class=\"parameter\"\u003e\u003ccode\u003elexeme\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003epositions\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003esmallint[]\u003c/code\u003e, \u003cem class=\"parameter\"\u003e\u003ccode\u003eweights\u003c/code\u003e\u003c/em\u003e \u003ccode class=\"type\"\u003etext\u003c/code\u003e )","returns":"setof record","text":"unnest ( tsvector ) → setof record ( lexeme text, positions smallint[], weights text )","zh_from":""}},{"Version":"18","Ordinal":1,"Hash":"029620499aae2e47f5efff41b1a56db44c683fc95b5e6b7e4d40d0dec97f6b3b","Text":"unnest ( anyarray ) → setof anyelement","Returns":"setof anyelement","Payload":{"description":"Expands an array into a set of rows. The array's elements are read out in storage order.","description_html":"Expands an array into a set of rows. The array's elements are read out in storage order.","description_zh":"","description_zh_html":"","examples":[{"expr":"unnest(ARRAY[1,2])","result":"1\n2"},{"expr":"unnest(ARRAY[['foo','bar'],['baz','quux']])","result":"foo\nbar\nbaz\nquux"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanyarray\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003esetof anyelement\u003c/code\u003e","returns":"setof anyelement","text":"unnest ( anyarray ) → setof anyelement","zh_from":""}},{"Version":"18","Ordinal":2,"Hash":"21c6cde3d542a7c37006bf9e5b0d5a78a94a3e2436ea9a54511bf82fa63b12f0","Text":"unnest ( anyarray, anyarray [, ... ] ) → setof anyelement, anyelement [, ... ]","Returns":"setof anyelement, anyelement [, ... ]","Payload":{"description":"Expands multiple arrays (possibly of different data types) into a set of rows. If the arrays are not all the same length then the shorter ones are padded with NULLs. This form is only allowed in a query's FROM clause; see Section 7.2.1.4.","description_html":"Expands multiple arrays (possibly of different data types) into a set of rows. If the arrays are not all the same length then the shorter ones are padded with \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003es. This form is only allowed in a query's FROM clause; see \u003ca href=\"/docs/18/queries-table-expressions.html#QUERIES-TABLEFUNCTIONS\" title=\"7.2.1.4. Table Functions\"\u003eSection 7.2.1.4\u003c/a\u003e.","description_zh":"","description_zh_html":"","examples":[{"expr":"select * from unnest(ARRAY[1,2], ARRAY['foo','bar','baz']) as x(a,b)","result":" a |  b\n---+-----\n 1 | foo\n 2 | bar\n   | baz"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanyarray\u003c/code\u003e, \u003ccode class=\"type\"\u003eanyarray\u003c/code\u003e [\u003cspan class=\"optional\"\u003e, ...\u003c/span\u003e ] ) → \u003ccode class=\"returnvalue\"\u003esetof anyelement, anyelement [, ... ]\u003c/code\u003e","returns":"setof anyelement, anyelement [, ... ]","text":"unnest ( anyarray, anyarray [, ... ] ) → setof anyelement, anyelement [, ... ]","zh_from":""}},{"Version":"18","Ordinal":3,"Hash":"be3fba373d78c40d7b1de831fbd8de542949755eae3d9f84ba2220c251b0723c","Text":"unnest ( anymultirange ) → setof anyrange","Returns":"setof anyrange","Payload":{"description":"Expands a multirange into a set of ranges in ascending order.","description_html":"Expands a multirange into a set of ranges in ascending order.","description_zh":"","description_zh_html":"","examples":[{"expr":"unnest('{[1,2), [3,4)}'::int4multirange)","result":"[1,2)\n[3,4)"}],"html":"\u003ccode class=\"function\"\u003eunnest\u003c/code\u003e ( \u003ccode class=\"type\"\u003eanymultirange\u003c/code\u003e ) → \u003ccode class=\"returnvalue\"\u003esetof anyrange\u003c/code\u003e","returns":"setof anyrange","text":"unnest ( anymultirange ) → setof anyrange","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
