Tom Lane <t...@sss.pgh.pa.us> writes:
> Yeah, I had forgotten about that loose end, but we definitely need
> something of the sort.  Committed with additional documentation.
> (I put something in the CREATE EVENT TRIGGER ref page, but do we
> need anything about it in chapter 37?)

Thanks!

I guess we could add a note at the end of the "Overview of Event Trigger
Behavior" section. Then maybe we should explain in that section that you
can't set an event trigger to fire on event trigger commands.

> BTW, is the example in the CREATE EVENT TRIGGER ref page meant as an
> IQ test for unwary readers?  You do know there are people who will
> copy-and-paste just about any example that's put in front of them.
> Perhaps we just want to make sure they internalize the advice about how
> to get out of a broken-event-trigger situation.

For those following at home, the example is:

    CREATE OR REPLACE FUNCTION abort_any_command()
      RETURNS event_trigger
     LANGUAGE plpgsql
      AS $$
    BEGIN
      RAISE EXCEPTION 'command % is disabled', tg_tag;
    END;
    $$;
    
    CREATE EVENT TRIGGER abort_ddl ON ddl_command_start
       EXECUTE PROCEDURE abort_any_command();

Maybe we could just append to it how to remove such an event trigger,
which is easy to do because you can't target an event trigger related
command with event triggers, so the following is not disabled:

    DROP EVENT TRIGGER abort_ddl;

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr     PostgreSQL : Expertise, Formation et Support


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

Reply via email to