Excerpts from Robert Haas's message of lun dic 12 13:32:45 -0300 2011: > On Sun, Dec 11, 2011 at 1:55 PM, Dimitri Fontaine > <dimi...@2ndquadrant.fr> wrote: > > Andres Freund <and...@anarazel.de> writes: > >> Hm. I just noticed a relatively big hole in the patch: The handling of > >> deletion of dependent objects currently is nonexistant because they don't > >> go > >> through ProcessUtility... > > > > That's the reason why we're talking about “command triggers” rather than > > “DDL triggers”. We don't intend to fire the triggers at each DDL > > operation happening on the server, but for each command. > > > > This restriction still allows us to provide a very useful feature when > > checked against the main use cases we target here. Those are auditing, > > and replication (the replay will also CASCADEs), and a generic enough > > SUDO facility (because the trigger function can well be SECURITY > > DEFINER). > > I haven't yet thought about your specific proposal here in enough to > have a fully-formed opinion, but I am a little nervous that this may > turn out to be one of those cases where the obvious API ends up > working less well than might have been supposed. For example, > consider the "auditing" use case, and suppose that the user wants to > log a message (to a table, or some other separate logging facility) > every time someone creates an index. In order to do that, they're > going to need to trap not only CREATE INDEX but also CREATE TABLE and > ALTER CONSTRAINT,
Yeah. I remember mentioning the ability of CREATE SCHEMA to embed all sort of object creation commands in a single top-level command, and being handwaved away by Jan. "Nobody knows about that", I was told. However, if this is to work in a robust way, these things should not be ignored. In particular, firing triggers on each top-level command _is_ going to get some objects ignored; the people writing the triggers _are_ going to forget to handle CREATE SCHEMA properly most of the time. -- Álvaro Herrera <alvhe...@commandprompt.com> The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers