Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Tvxei-00070d-6f for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jan 2013 22:09:52 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Tvxeh-00065V-AH for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jan 2013 22:09:51 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvxeY-0005ya-E2 for pgsql-hackers@postgresql.org; Thu, 17 Jan 2013 22:09:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TvxeX-00086A-DM for pgsql-hackers@postgresql.org; Thu, 17 Jan 2013 22:09:41 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r0HM9aJa018500; Thu, 17 Jan 2013 17:09:36 -0500 (EST) From: Tom Lane To: Robert Haas cc: Dimitri Fontaine , Alvaro Herrera , PostgreSQL Hackers Subject: Re: Event Triggers: adding information In-reply-to: References: <20130104205251.GB9191@alvh.no-ip.org> <20130109165829.GB4490@alvh.no-ip.org> Comments: In-reply-to Robert Haas message dated "Thu, 17 Jan 2013 15:56:24 -0500" Date: Thu, 17 Jan 2013 17:09:36 -0500 Message-ID: <18499.1358460576@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > Let me try to give a concrete example of how I think another firing > point could be made to work along the lines I'm suggesting. > [ snip description of how an event trigger might safely be fired just > after identification and locking of the target object for an ALTER ] Reading that and reflecting on my gripe about the lack of any clear architecture for our DDL code, I had the beginnings of an idea. Perhaps it would improve matters if we refactored DDL processing so that there were separate "parse analysis" and "execution" phases, where parse analysis is (perhaps among other responsibilities) responsible for identifying and locking all objects to be used in the command. I note that locking the referenced tables is the responsibility of the parse analysis step in DML processing, so there's solid precedent for this. Also, we have some of this approach already for certain commands such as CREATE TABLE, cf parse_utilcmd.c. If we did that, then it'd be feasible to fire event triggers after the parse analysis step, and the rechecking that Robert describes could be encapsulated as "redo the parse analysis and see if the result changed". It's not clear to me just how this ought to extend to the cascaded-DROP or inherited-table-ALTER cases, but hey, it's only the beginnings of an idea. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers