Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Howto check for existing aggregate functions in Postgres?

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?

like image 896
Mike Rohland Avatar asked Mar 02 '23 04:03

Mike Rohland


1 Answers

SELECT * FROM pg_proc WHERE proname = 'name' AND proisagg; 
  • http://www.postgresql.org/docs/8.3/interactive/catalogs-overview.html
  • http://www.postgresql.org/docs/8.3/interactive/catalog-pg-aggregate.html
  • http://www.postgresql.org/docs/8.3/interactive/catalog-pg-proc.html
like image 137
Kent Fredric Avatar answered Mar 03 '23 18:03

Kent Fredric