The gp_array_agg
module introduces a parallel array_agg()
aggregate function that you can use in Greenplum Database.
The gp_array_agg
module is a Greenplum Database extension.
Installing and Registering the Module
The gp_array_agg
module is installed when you install Greenplum Database. Before you can use the aggregate function defined in the module, you must register the gp_array_agg
extension in each database where you want to use the function:
Refer to Installing Additional Supplied Modules for more information.
Using the Module
The gp_array_agg()
function has the following signature:
You can use the function to create an array from input values, including nulls. For example:
gp_array_agg()
assigns each input value to an array element, and then returns the array. The function returns null rather than an empty array when there are no input rows.
gp_array_agg()
produces results that depend on the ordering of the input rows. The ordering is unspecified by default; you can control the ordering by specifying an ORDER BY
clause within the aggregate. For example:
Additional Module Documentation
Refer to Aggregate Functions in the PostgreSQL documentation for more information about aggregates.
Content feedback and comments