Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id DC32619964F2 for ; Fri, 16 Mar 2012 18:10:30 -0300 (ADT) Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S8ePs-00066s-IR for pgsql-hackers@postgresql.org; Fri, 16 Mar 2012 21:10:29 +0000 Received: by mail.anarazel.de (Postfix, from userid 108) id BC923448003; Fri, 16 Mar 2012 22:10:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on mail X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from anarazel.de (brln-4d0cc7c8.pool.mediaWays.net [77.12.199.200]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id E5EAB448003; Fri, 16 Mar 2012 22:07:24 +0100 (CET) Received: by anarazel.de (Postfix, from userid 1000) id 1DCD21C00AA; Fri, 16 Mar 2012 22:07:23 +0100 (CET) From: Andres Freund To: Tom Lane Subject: Re: Command Triggers, patch v11 Date: Fri, 16 Mar 2012 22:07:23 +0100 User-Agent: KMail/1.13.7 (Linux/3.3.0-rc3-andres-00278-g4903062; KDE/4.6.5; x86_64; ; ) Cc: pgsql-hackers@postgresql.org, Thom Brown , Dimitri Fontaine References: <201203041650.39826.andres@anarazel.de> <20905.1331931287@sss.pgh.pa.us> In-Reply-To: <20905.1331931287@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201203162207.23896.andres@anarazel.de> X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201203/1112 X-Sequence-Number: 204994 On Friday, March 16, 2012 09:54:47 PM Tom Lane wrote: > Andres Freund writes: > > [ ctas-01.patch ] > > I'm starting to look at this now. Great! > For a patch that's supposed to de-complicate things, it seems pretty messy :-( Yea. It started out simple but never stopped getting more complicated. Getting rid of the duplication still seems to make sense to me though. > One thing I soon found is that it lacks support for EXPLAIN SELECT INTO. > That used to work, but now you get > > regression=# explain select * into foo from tenk1; > ERROR: INTO is only allowed on first SELECT of UNION/INTERSECT/EXCEPT > LINE 1: explain select * into foo from tenk1; > ^ > > and while fixing the parse analysis for that is probably not too hard, > it would still fail to work nicely, since explain.c lacks support for > CreateTableAsStmt utility statements.I think we'd have to invent > something parallel to ExplainExecuteQuery to support this, and I really > doubt that it's worth the trouble. Does anyone have a problem with > desupporting the case? I am all for removing it. > Also, it seems to me that the patch is spending way too much effort on > trying to exactly duplicate the old error messages for various flavors > of "INTO not allowed here", and still not succeeding terribly well. > I'm inclined to just have a one-size-fits-all message in > transformSelectStmt, which will fire if intoClause hasn't been cleared > before we get there; any objections? I was/am decidedly unhappy about the whole error message stuff. Thats what turned the patch from removing lines to making it bigger than before. I tried to be compatible to make sure I understood what was happening. I am fine with making it one simple error message. > A couple of other cosmetic thoughts: I'm tempted to split the execution > support out into a new file, rather than bloat tablecmds.c any further; > and I'm wondering if the interface to EXECUTE INTO can't be simplified. > (It may have been a mistake to remove the IntoClause in ExecuteStmt.) Hm. I vote against keeping the IntoClause stuff in ExecuteStmt. Splitting stuff from tablecmd.c seems sensible though. One more thing I disliked quite a bit was the duplication of the EXECUTE handling. Do you see a way to deduplicate that? If you give me some hints about what to change I am happy to revise the patch myself should you prefer that. Andres