Reputation: 393
In Postgresql you can create additional Aggregate Functions with
CREATE AGGREGATE name(...);
But this gives an error if the aggregate already exists inside the database, so how can I check if a Aggregate already exists in the Postgres Database?
Upvotes: 4
Views: 5998
Reputation: 48883
drop aggregate if exists my_agg(varchar);
create aggregate my_agg(varchar) (...);
select * from pg_aggregate
where aggfnoid = 'my_agg'::regproc;
Upvotes: -1
Reputation: 57374
SELECT * FROM pg_proc WHERE proname = 'name' AND proisagg;
Upvotes: 9