X-Original-To: pgsql-hackers-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A50ED9FB2F7 for ; Sat, 29 Jul 2006 22:36:13 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 16484-08 for ; Sat, 29 Jul 2006 22:36:08 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id E64879FB2F3 for ; Sat, 29 Jul 2006 22:35:38 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k6U1ZOx9021399; Sat, 29 Jul 2006 21:35:24 -0400 (EDT) To: Joe Conway cc: Christopher Kings-Lynne , "Hackers (PostgreSQL)" , Andrew Dunstan , Bernd Helmle , Peter Eisentraut , Susanne Ebrecht Subject: Re: Values list-of-targetlists patch for comments (was Re: [PATCHES] 8.2 features?) In-reply-to: <44CC0A66.6070903@joeconway.com> References: <44B69778.5050104@dunslane.net> <50461.84.63.113.55.1152832991.squirrel@pezone.net> <44B7ADFC.90205@dunslane.net> <44BC0432.3040509@joeconway.com> <44BC661F.80609@joeconway.com> <44BCD06C.3060409@calorieking.com> <44BCF1D4.3010807@dunslane.net> <5842.1153246741@sss.pgh.pa.us> <44BD8854.9060506@calorieking.com> <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> <44C4451A.4010906@joeconway.com> <11495.1153757531@sss.pgh.pa.us> <44C4F625.2050304@joeconway.com> <12029.1153760969@sss.pgh.pa.us> <44CC0A66.6070903@joeconway.com> Comments: In-reply-to Joe Conway message dated "Sat, 29 Jul 2006 18:24:54 -0700" Date: Sat, 29 Jul 2006 21:35:24 -0400 Message-ID: <21398.1154223324@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.054 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200607/1533 X-Sequence-Number: 87388 Joe Conway writes: > One of the things I'm struggling with is lack of column aliases. Would > it be reasonable to require something like this? > SELECT ... FROM (VALUES ...) AS foo(col1, col2, ...) Requiring column aliases is counter to spec ... > The other issue is how to determine column type. Even better would be to > require (similar to SRF returning record): > SELECT ... FROM (VALUES ...) AS foo(col1 type1, col2 type2, ...) ... and this is even further away from it. As for the names, just use "?column?", same as we do now in INSERT ... VALUES. Anyone who wants to refer to those columns explicitly will need to assign aliases, but if they don't assign aliases, we don't have to do anything very intelligent. As for the types, I believe that the spec pretty much dictates that we apply the same type resolution algorithm as for a UNION. This is fairly expensive and we should avoid it in the case of INSERT ... VALUES, but for VALUES appearing anywhere else I think we have little choice. regards, tom lane