Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 26003176E18B for ; Sat, 17 Mar 2012 14:45:45 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S8xhH-000803-P8 for pgsql-hackers@postgresql.org; Sat, 17 Mar 2012 17:45:44 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q2HHjSpe009504; Sat, 17 Mar 2012 13:45:28 -0400 (EDT) To: Andres Freund , pgsql-hackers@postgresql.org, Thom Brown , Dimitri Fontaine Subject: Re: Command Triggers, patch v11 In-reply-to: <7094.1331996567@sss.pgh.pa.us> References: <201203162237.38813.andres@anarazel.de> <21818.1331934775@sss.pgh.pa.us> <201203162317.43818.andres@anarazel.de> <7094.1331996567@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 17 Mar 2012 11:02:47 -0400" Date: Sat, 17 Mar 2012 13:45:27 -0400 Message-ID: <9503.1332006327@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/1154 X-Sequence-Number: 205036 While looking at this I also noticed that DECLARE CURSOR uses a structure that's randomly different in yet a third way: we start with a utility statement containing a query, and then flip that upside down so that the SELECT Query contains a utility statement! I have a vague feeling that I'm the one who's guilty of that hack, too. I'm not sure that anybody cares about being able to fire command triggers on DECLARE CURSOR, but just from a consistency standpoint it would make sense for this to work more like EXPLAIN and CREATE TABLE AS. So that convinces me that UtilityContainsQuery() would be a good thing, and I'll add that to the patch. (Actually changing DECLARE CURSOR seems like a separate patch, though.) regards, tom lane