X-Original-To: pgsql-hackers-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id 526229FA7B6 for ; Fri, 21 Jul 2006 11:08:49 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 50236-05 for ; Fri, 21 Jul 2006 14:08:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from noel.decibel.org (noel.decibel.org [67.100.216.10]) by postgresql.org (Postfix) with ESMTP id 8D1A59FA6B5 for ; Fri, 21 Jul 2006 11:08:37 -0300 (ADT) Received: by noel.decibel.org (Postfix, from userid 1001) id DA81256441; Fri, 21 Jul 2006 09:08:34 -0500 (CDT) Received: (hashcash-sendmail, from uid 1001); Fri, 21 Jul 2006 09:08:33 -0500 Date: Fri, 21 Jul 2006 09:08:32 -0500 From: "Jim C. Nasby" To: Tom Lane Cc: Joe Conway , Christopher Kings-Lynne , "Hackers (PostgreSQL)" , Andrew Dunstan , Bernd Helmle , Peter Eisentraut , Susanne Ebrecht Subject: Re: [PATCHES] 8.2 features? Message-ID: <20060721140832.GD83250@pervasive.com> References: <15212.1153279954@sss.pgh.pa.us> <44BDB2F5.7080003@joeconway.com> <44BEA710.6060700@joeconway.com> <23198.1153367887@sss.pgh.pa.us> <44BF0382.2010501@joeconway.com> <23454.1153370214@sss.pgh.pa.us> <44BF122F.1080200@joeconway.com> <23927.1153373971@sss.pgh.pa.us> <44C00E1E.1000405@joeconway.com> <14047.1153442773@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <14047.1153442773@sss.pgh.pa.us> X-Operating-System: FreeBSD 6.0-RELEASE-p4 amd64 X-Distributed: Join the Effort! http://www.distributed.net User-Agent: Mutt/1.5.11 X-Hashcash: 1:20:060721:tgl@sss.pgh.pa.us::gdHSWMWk29WQ+i8v:00000000000000000000 0000000000000000000000005u7U X-Hashcash: 1:20:060721:mail@joeconway.com::+a9BzDbesBJm01pA:0000000000000000000 0000000000000000000000002spw X-Hashcash: 1:20:060721:chris.kings-lynne@calorieking.com::2MVHW2iZS/9P9t4Z:0000 0000000000000000000000001ZkN X-Hashcash: 1:20:060721:pgsql-hackers@postgresql.org::8p6QWd8aWsgUrr50:000000000 0000000000000000000000002slV X-Hashcash: 1:20:060721:andrew@dunslane.net::qqgRDbmCJgN+FCwU:000000000000000000 00000000000000000000000020cu X-Hashcash: 1:20:060721:mailings@oopsware.de::pcif80mTm8EgyoFi:00000000000000000 0000000000000000000000003Bhw X-Hashcash: 1:20:060721:peter_e@gmx.net::i7YvAcwxRFoZOlmd:001uPk X-Hashcash: 1:20:060721:susanne.ebrecht@credativ.de::y9p4rao7OhJ0fpUL:0000000000 0000000000000000000000001eh4 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200607/941 X-Sequence-Number: 86796 On Thu, Jul 20, 2006 at 08:46:13PM -0400, Tom Lane wrote: > Joe Conway writes: > > I'm liking this too. But when you say "jointree node", are you saying to > > model the new node type after NestLoop/MergeJoin/HashJoin nodes? These > > are referred to as "join nodes" in ExecInitNode. Or as you mentioned a > > couple of times, should this look more like an Append node? > > No, I guess I confused you by talking about the executor representation > at the same time. This is really unrelated to the executor. The join > tree I'm thinking of here is the data structure that dangles off > Query.jointree --- it's a representation of the query's FROM clause, > and (at present) can contain RangeTblRef, FromExpr, and JoinExpr nodes. > See the last hundred or so lines of primnodes.h for some details. > The jointree is used by the planner to compute the plan node tree that > the executor will run, but it's not the same thing. > > There are basically two ways you could go about this: > 1. Make a new jointree leaf node type to represent a VALUES construct, > and dangle the list of lists of expressions off that. > 2. Make a new RangeTblEntry type to represent a VALUES construct, and > just put a RangeTblRef to it into the jointree. The expressions > dangle off the RangeTblEntry. > > Offhand I'm not certain which of these would be cleanest. The second > way has some similarities to the way we handle set operation trees > (UNION et al), so it might be worth looking at that stuff. However, > being a RangeTblEntry has a lot of baggage (eg, various routines expect > to find an RTE alias, column names, column types, etc) and maybe we > don't need all that for VALUES. I misread that to include SRFs, but it got me thinking... another possibility would be to changes VALUES() so that it was treated as a function, and allow it to have an arbitrary number of parameters. That would automatically allow the case of SELECT * FROM VALUES(...). INSERT would need to learn how to accept SRFs, but that would have the nice side-effect of allowing INSERT INTO table set_returning_function(); Of course, adding the ability for functions to have an arbitrary argument list could well be more complex than any of the options discussed thusfar... though it would be a very handy feature to have. -- Jim C. Nasby, Sr. Engineering Consultant jnasby@pervasive.com Pervasive Software http://pervasive.com work: 512-231-6117 vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461