if (!ref($filters->{attribute_values}));
$query->{having}->{'+bram'}->{value}->{'@>'} = {
- transform => 'array_accum',
+ transform => 'array_agg',
value => '$_' . $$ . '${' .
join(',', @{$filters->{attribute_values}}) .
'}$_' . $$ . '$'
if (!ref($filters->{attribute_values}));
$query->{having}->{'+bravm'}->{attr_value}->{'@>'} = {
- transform => 'array_accum',
+ transform => 'array_agg',
value => '$_' . $$ . '${' .
join(',', @{$filters->{attribute_values}}) .
'}$_' . $$ . '$'
BEGIN;
-DROP AGGREGATE IF EXISTS array_accum(anyelement) CASCADE;
DROP AGGREGATE IF EXISTS public.first(anyelement) CASCADE;
DROP AGGREGATE IF EXISTS public.last(anyelement) CASCADE;
DROP AGGREGATE IF EXISTS public.agg_text(text) CASCADE;
-CREATE AGGREGATE array_accum (
- sfunc = array_append,
- basetype = anyelement,
- stype = anyarray,
- initcond = '{}'
-);
-
CREATE OR REPLACE FUNCTION public.first_agg ( anyelement, anyelement ) RETURNS anyelement AS $$
SELECT CASE WHEN $1 IS NULL THEN $2 ELSE $1 END;
$$ LANGUAGE SQL STABLE;
SELECT is(
(
SELECT COUNT(*) FROM (
- SELECT search.facets_for_metarecord_set('{}', array_accum(metarecord))
+ SELECT search.facets_for_metarecord_set('{}', array_agg(metarecord))
FROM metabib.metarecord_source_map
WHERE source = 999999998
) x
--- /dev/null
+BEGIN;
+
+--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+DROP AGGREGATE IF EXISTS array_accum(anyelement) CASCADE;
+
+COMMIT;
--- /dev/null
+== array_accum Aggregate Removed ==
+
+The custom `array_accum` aggregate function has been removed from the
+PostgreSQL database because it will need to be dropped and recreated
+with a different definition when upgrading to PostgreSQL version 14 or
+later. Its functionality is also redundant with PostgreSQL's own
+`array_agg` function.
+
+Sites that have custom code using Evergreen's `array_accum` function
+should alter their code to use `array_agg` instead.