From: | Erik Jones <erik(at)myemma(dot)com> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org> |
Cc: | Josh Trutwin <josh(at)trutwins(dot)homeip(dot)net>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Checking if Aggregate exists |
Date: | 2008-03-24 19:02:02 |
Message-ID: | 700F56D4-1122-4B33-8AA8-D3F3CF27DA59@myemma.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Mar 24, 2008, at 1:09 PM, Martijn van Oosterhout wrote:
> On Mon, Mar 24, 2008 at 12:47:43PM -0500, Josh Trutwin wrote:
>> My code to check if an aggregate exists runs this query:
>>
>> SELECT * FROM pg_catalog.pg_aggretate WHERE aggfnoid =
>> 'foo'::REGPROC;
>
> Seems to me you'd rather want the proisagg column in pg_proc and
> forget
> about pg_aggregate altogether...
Also, the idiom for checking if something is present is normally:
SELECT 1 FROM some_table WHERE ...;
This way you aren't dealing with errors, if it doesn't exist the query
simply doesn't return any results.
Erik Jones
DBA | Emma®
erik(at)myemma(dot)com
800.595.4401 or 615.292.5888
615.292.0777 (fax)
Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com
From | Date | Subject | |
---|---|---|---|
Next Message | Alex Solovey | 2008-03-24 19:15:59 | Problem with update on partitioned table |
Previous Message | Alvaro Herrera | 2008-03-24 18:17:55 | Re: Checking if Aggregate exists |