LANGUAGE 'c' IMMUTABLE STRICT _PARALLEL;
-- Availability: 1.2.2
--- Changed: 2.4.0 marked parallel safe
+-- Changed but upgrader helper no touch: 2.4.0 marked parallel safe
+-- we don't want to force drop of this agg since its often used in views
+-- parallel handling dealt with in postgis_drop_after.sql
CREATE AGGREGATE ST_Union (geometry) (
sfunc = pgis_geometry_accum_transfn,
stype = pgis_abs,
finalfunc = pgis_geometry_union_finalfn
);
+
-- Availability: 1.2.2
-- Changed: 2.4.0: marked parallel safe
CREATE AGGREGATE ST_Collect (geometry) (
-- pgis_abs type was increased from 8 bytes in 2.1 to 16 bytes in 2.2
-- See #3460
UPDATE pg_type SET typlen=16 WHERE typname='pgis_abs' AND typlen=8;
+
+DO language 'plpgsql'
+$$
+BEGIN
+IF _postgis_scripts_pgsql_version()::integer >= 96 THEN
+-- mark ST_Union agg as parallel safe if it is not already
+ UPDATE pg_proc SET proparallel = 's'
+ WHERE oid = 'st_union(geometry)'::regprocedure AND proparallel = 'u';
+END IF;
+END;
+$$;