Come verificare le funzioni aggregate esistenti in Postgres?
-
08-07-2019 - |
Domanda
In Postgresql è possibile creare funzioni aggregate aggiuntive con
CREATE AGGREGATE name(...);
Ma questo dà un errore se l'aggregato esiste già all'interno del database, quindi come posso verificare se un aggregato esiste già nel database Postgres?
Soluzione
SELECT * FROM pg_proc WHERE proname = 'name' AND proisagg;
Altri suggerimenti
drop aggregate if exists my_agg(varchar);
create aggregate my_agg(varchar) (...);
select * from pg_aggregate
where aggfnoid = 'my_agg'::regproc;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow