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

From David Rowley
Subject Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly
Date
Msg-id CAKJS1f8FRsP15AN6LNx7FpOpizj1_BGqqAwZbqLrP468ZmsnZg@mail.gmail.com
Whole thread Raw
In response to Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: v9.1, DROP TRIGGER IF EXISTS behaving oddly
List pgsql-general
On 14 January 2016 at 11:32, Adrian Klaver <adrian.klaver@aklaver.com> wrote:
On 01/13/2016 02:24 PM, Tom Lane wrote:
"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.

Alright now I am confused. Other then changing table to table_name I am not seeing where the below changed. In both cases a NOTICE is supposed to be raised.

http://www.postgresql.org/docs/9.1/interactive/sql-droptrigger.html

http://www.postgresql.org/docs/9.4/interactive/sql-droptrigger.html


Perhaps that commit should have also made changes to the documents to change things such as:

Do not throw an error if the trigger does not exist. A notice is issued in this case.

To

Do not throw an error if the trigger or table does not exist. A notice is issued in this case.

--
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

pgsql-general by date:

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