pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: hillel.eilat@attunity.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13597: Event trigger fires on conditional DDL when no DDL action is carried out
Date: Sun, 30 Aug 2015 10:58:18 +0000
Message-ID: <20150830105818.2090.27792@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      13597
Logged by:          Hillel Eilat
Email address:      hillel.eilat@attunity.com
PostgreSQL version: 9.4.4
Operating system:   Windows 7
Description:        

I do not know if this a bug or something that is not fully documented.

I use event trigger for tracking DDL-s

The trigger captures the DDL text by
retrieving current_query().

Now - there is a non-existent table - 
say T_DUMMY.

Following conditional statement will
cause the trigger to fire:
DROP TABLE IF EXISTS T_DUMMY.
Trigger fires - although - no DROP DDL was carried out.
Reproduction is given below.

Is it what it meant to be?

Thanks
Hillel.

Reproduction:
-------------



1.	My prototyped stuff
        ====================

CREATE OR REPLACE FUNCTION intercept_ddl()
  RETURNS event_trigger AS
$BODY$
  declare _qry text;
BEGIN
	SELECT current_query() into _qry;
	RAISE NOTICE 'DDLtype=''%'' XID=% DDL=%', tg_tag,cast(TXID_CURRENT()as
varchar(16)), _qry;
END;
$BODY$

CREATE EVENT TRIGGER intercept_ddl ON ddl command end EXECUTE PROCEDURE
intercept_ddl();

2.	Introducing a non-existent table
        ================================

select * from attu.T_DUMMY

ERROR:  relation "attu.t_dummy" does not exist

3.	Conditionally dropping a non-existent table
======================================

drop table if exists attu.T_DUMMY

NOTICE:  table "t_dummy" does not exist, skipping
NOTICE:  DDLtype='DROP TABLE' XID=723 DDL=drop table if exists attu.T_DUMMY

Query returned successfully with no result in 23 ms.






 


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



Message-ID: <20150830105818.2090.27792@wrigleys.postgresql.org>
Permalink:  ../20150830105818.2090.27792@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20150830105818.2090.27792@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hillel.eilat@attunity.com
  Subject: Re: BUG #13597: Event trigger fires on conditional DDL when no DDL action is carried out
  In-Reply-To: <20150830105818.2090.27792@wrigleys.postgresql.org>
  References: <20150830105818.2090.27792@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox