Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Williamson, Michael" <Michael(dot)Williamson(at)tamucc(dot)edu>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly
Date: 2016-01-13 22:27:09
Message-ID: 5696CF3D.1070601@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/13/2016 02:14 PM, Williamson, Michael wrote:
> 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
>

Is that happening on all triggers you are trying to DROP, or just this one?

If just this one, you might want to check to see if the trigger was
created with a quoted mixed case name and therefore needs to have the
exact case quoted when used in the DROP TRIGGER. Something else to look
at is whether there is more then one customer table and you need to
schema qualify the name.

>
> Thanks,
> Michael
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2016-01-13 22:32:57 Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly
Previous Message Tom Lane 2016-01-13 22:24:11 Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly