{"Entry":{"collection":"func","key":"json-arrayagg","name":"json_arrayagg","aliases":[],"metadata":{"changed_in":[],"changes":[{"descriptions_changed":false,"doc_overhaul":false,"from":"15","group_changed":null,"signatures":{"added":[],"removed":[]},"status":"added","to":"16"}],"content_hash":"8e18860e49c12a4fdea02092fe3268788d23a9e0ee389d53ca08b9c9ae49a410","first_version":"16","group":"aggregate","group_label":"Aggregate Functions","groups":["aggregate"],"imported_at":"2026-09-14T21:49:48.854027+08:00","last_version":"20","name":"json_arrayagg","name_key":"json_arrayagg","position":21018,"present_in":["16","17","18","19","20"],"signature":"json_arrayagg ( [ value_expression ] [ ORDER BY sort_expression ] [ { NULL | ABSENT } ON NULL ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])","signature_count":1,"slug":"json-arrayagg","source_rev":"2026-09-14T13:14:25.684213+00:00@99e6866c","summary":"Behaves in the same way as json_array but as an aggregate function so it only takes one value_expression parameter.","summary_zh":""}},"Definition":{"Collection":"func","Key":"json-arrayagg","SourceDatabase":"center","Version":"18","SourceTable":"func","SourceKey":"json-arrayagg","SourceRevision":"2026-09-14T13:14:25.684213+00:00@99e6866c","Facts":{"description":"Behaves in the same way as json_array but as an aggregate function so it only takes one value_expression parameter. If ABSENT ON NULL is specified, any NULL values are omitted. If ORDER BY is specified, the elements will appear in the array in that order rather than in the input order.","description_html":"Behaves in the same way as \u003ccode class=\"function\"\u003ejson_array\u003c/code\u003e but as an aggregate function so it only takes one \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e parameter. If \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified, any NULL values are omitted. If \u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e is specified, the elements will appear in the array in that order rather than in the input order.","description_zh":"","description_zh_html":"","doc":{"anchor":"FUNCTIONS-AGGREGATE-TABLE","file":"functions-aggregate.html","slug":"18"},"group":"aggregate","group_label":"Aggregate Functions","lang":"en","layout":"table-new","pages":["functions-aggregate.html"],"prose_only":false,"signatures":[{"description":"Behaves in the same way as json_array but as an aggregate function so it only takes one value_expression parameter. If ABSENT ON NULL is specified, any NULL values are omitted. If ORDER BY is specified, the elements will appear in the array in that order rather than in the input order.","description_html":"Behaves in the same way as \u003ccode class=\"function\"\u003ejson_array\u003c/code\u003e but as an aggregate function so it only takes one \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e parameter. If \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified, any NULL values are omitted. If \u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e is specified, the elements will appear in the array in that order rather than in the input order.","description_zh":"","description_zh_html":"","examples":[{"expr":"SELECT json_arrayagg(v) FROM (VALUES(2),(1)) t(v)","result":"[2, 1]"}],"html":"\u003ccode class=\"function\"\u003ejson_arrayagg\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003esort_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e{ \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e | \u003ccode class=\"literal\"\u003eABSENT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eON NULL\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eRETURNING\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003edata_type\u003c/code\u003e\u003c/em\u003e [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e ]\u003c/span\u003e ]\u003c/span\u003e ])","returns":"","text":"json_arrayagg ( [ value_expression ] [ ORDER BY sort_expression ] [ { NULL | ABSENT } ON NULL ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])","zh_from":""}],"zh_from":""},"ManualEvidence":{"doc":{"anchor":"FUNCTIONS-AGGREGATE-TABLE","file":"functions-aggregate.html","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"func","Key":"json-arrayagg","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"json_arrayagg","Summary":"行为与json_array相同，只是它作为一个聚合函数，因此只接受一个 value_expression参数。如果指定了ABSENT ON NULL，则会省略所有 NULL 值。如果指定了ORDER BY，元素将按该顺序出现在数组中，而不是按输入顺序。","BodyHTML":"行为与\u003ccode\u003ejson_array\u003c/code\u003e相同，只是它作为一个聚合函数，因此只接受一个 \u003cem\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e参数。如果指定了\u003ccode\u003eABSENT ON NULL\u003c/code\u003e，则会省略所有 NULL 值。如果指定了\u003ccode\u003eORDER BY\u003c/code\u003e，元素将按该顺序出现在数组中，而不是按输入顺序。\u003cpre\u003ejson_arrayagg ( [ value_expression ] [ ORDER BY sort_expression ] [ { NULL | ABSENT } ON NULL ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])\u003c/pre\u003e行为与\u003ccode\u003ejson_array\u003c/code\u003e相同，只是它作为一个聚合函数，因此只接受一个 \u003cem\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e参数。如果指定了\u003ccode\u003eABSENT ON NULL\u003c/code\u003e，则会省略所有 NULL 值。如果指定了\u003ccode\u003eORDER BY\u003c/code\u003e，元素将按该顺序出现在数组中，而不是按输入顺序。","SourceRevision":"1b5ca64c","ContentHash":"b9110cb2cbc54d25230549040d122a5e8c36f58858d48ec777013eef9b7bf90c","Payload":{"description_zh":"行为与json_array相同，只是它作为一个聚合函数，因此只接受一个 value_expression参数。如果指定了ABSENT ON NULL，则会省略所有 NULL 值。如果指定了ORDER BY，元素将按该顺序出现在数组中，而不是按输入顺序。","description_zh_html":"行为与\u003ccode class=\"function\"\u003ejson_array\u003c/code\u003e相同，只是它作为一个聚合函数，因此只接受一个 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e参数。如果指定了\u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e，则会省略所有 NULL 值。如果指定了\u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e，元素将按该顺序出现在数组中，而不是按输入顺序。","signatures":[{"description_zh":"行为与json_array相同，只是它作为一个聚合函数，因此只接受一个 value_expression参数。如果指定了ABSENT ON NULL，则会省略所有 NULL 值。如果指定了ORDER BY，元素将按该顺序出现在数组中，而不是按输入顺序。","description_zh_html":"行为与\u003ccode class=\"function\"\u003ejson_array\u003c/code\u003e相同，只是它作为一个聚合函数，因此只接受一个 \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e参数。如果指定了\u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e，则会省略所有 NULL 值。如果指定了\u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e，元素将按该顺序出现在数组中，而不是按输入顺序。","returns":"","text":"json_arrayagg ( [ value_expression ] [ ORDER BY sort_expression ] [ { NULL | ABSENT } ON NULL ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])","zh_from":"doc"}],"zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["16","17","18","19","20"],"Locales":["en","zh-Hans"],"Signatures":[{"Version":"18","Ordinal":0,"Hash":"af2939219d7e3205e10278e4d7fa5eea3afd485229290dede1dc7f0d60299a8b","Text":"json_arrayagg ( [ value_expression ] [ ORDER BY sort_expression ] [ { NULL | ABSENT } ON NULL ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])","Returns":"","Payload":{"description":"Behaves in the same way as json_array but as an aggregate function so it only takes one value_expression parameter. If ABSENT ON NULL is specified, any NULL values are omitted. If ORDER BY is specified, the elements will appear in the array in that order rather than in the input order.","description_html":"Behaves in the same way as \u003ccode class=\"function\"\u003ejson_array\u003c/code\u003e but as an aggregate function so it only takes one \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e parameter. If \u003ccode class=\"literal\"\u003eABSENT ON NULL\u003c/code\u003e is specified, any NULL values are omitted. If \u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e is specified, the elements will appear in the array in that order rather than in the input order.","description_zh":"","description_zh_html":"","examples":[{"expr":"SELECT json_arrayagg(v) FROM (VALUES(2),(1)) t(v)","result":"[2, 1]"}],"html":"\u003ccode class=\"function\"\u003ejson_arrayagg\u003c/code\u003e ( [ \u003cspan class=\"optional\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eORDER BY\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003esort_expression\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e{ \u003ccode class=\"literal\"\u003eNULL\u003c/code\u003e | \u003ccode class=\"literal\"\u003eABSENT\u003c/code\u003e } \u003ccode class=\"literal\"\u003eON NULL\u003c/code\u003e\u003c/span\u003e ] [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eRETURNING\u003c/code\u003e \u003cem class=\"replaceable\"\u003e\u003ccode\u003edata_type\u003c/code\u003e\u003c/em\u003e [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eFORMAT JSON\u003c/code\u003e [ \u003cspan class=\"optional\"\u003e\u003ccode class=\"literal\"\u003eENCODING UTF8\u003c/code\u003e\u003c/span\u003e ]\u003c/span\u003e ]\u003c/span\u003e ])","returns":"","text":"json_arrayagg ( [ value_expression ] [ ORDER BY sort_expression ] [ { NULL | ABSENT } ON NULL ] [ RETURNING data_type [ FORMAT JSON [ ENCODING UTF8 ] ] ])","zh_from":""}}],"Spellings":null,"SQLState":null,"Evidence":null}
