Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly - Mailing list pgsql-general

From Tom Lane
Subject Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly
Date
Msg-id 1413.1452723851@sss.pgh.pa.us
Whole thread Raw
In response to v9.1, DROP TRIGGER IF EXISTS behaving oddly  ("Williamson, Michael" <Michael.Williamson@tamucc.edu>)
Responses Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly
List pgsql-general
"Williamson, Michael" <Michael.Williamson@tamucc.edu> writes:
> I'm attempting to drop a trigger that may or may not exist, so am using
> the "IF EXISTS" clause.  This works fine for tables, views, functions,
> domains, and types, but for some reason seems to be ignored for
> triggers.  I'd expect to see more about this online if it were a bug,
> so I'm thinking I may be missing something obvious.

> Example:
> DROP TRIGGER IF EXISTS udf_customer_update_trigger ON customer;

> Expected Output:
> NOTICE:  trigger "udf_customer_update_trigger" does not exist, skipping

> Observed Output:
> ERROR:  relation "udf_customer_update_trigger" does not exist

> Environment:
> CentOS 6.6
> postgresql91-server-9.1.14-1PGDG.rhel6.x86_64

This has worked the way you're imagining since (I think) 9.4.  Before
that the "if exists" semantics only applied to the trigger itself,
not to the relation.

            regards, tom lane


pgsql-general by date:

Previous
From: "Williamson, Michael"
Date:
Subject: v9.1, DROP TRIGGER IF EXISTS behaving oddly
Next
From: Adrian Klaver
Date:
Subject: Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly