4

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?

2 Answers 2

9
SELECT * FROM pg_proc WHERE proname = 'name' AND proisagg; 
Sign up to request clarification or add additional context in comments.

Comments

-1
drop aggregate if exists my_agg(varchar);

create aggregate my_agg(varchar) (...);

select * from pg_aggregate
where aggfnoid = 'my_agg'::regproc;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.