X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A1579DCC52 for ; Mon, 13 Mar 2006 10:57:41 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61016-07 for ; Mon, 13 Mar 2006 10:57:45 -0400 (AST) 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 B35719DCC41 for ; Mon, 13 Mar 2006 10:57:38 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id k2DEvdiP007170; Mon, 13 Mar 2006 09:57:39 -0500 (EST) To: Markus Schaber cc: PostgreSQL SQL List Subject: Re: Set generating functions and subqueries In-reply-to: <441566CF.2040105@logix-tt.com> References: <44116ED2.9060901@logix-tt.com> <5142.1142002128@sss.pgh.pa.us> <441566CF.2040105@logix-tt.com> Comments: In-reply-to Markus Schaber message dated "Mon, 13 Mar 2006 13:34:23 +0100" Date: Mon, 13 Mar 2006 09:57:39 -0500 Message-ID: <7169.1142261859@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.112 required=5 tests=[AWL=0.112] X-Spam-Score: 0.112 X-Spam-Level: X-Archive-Number: 200603/190 X-Sequence-Number: 24536 Markus Schaber writes: > Tom Lane wrote: >> The fact that the other form is even allowed is more of a holdover from >> PostQUEL than something we have consciously decided is a good idea. >> (IMHO it's actually a fairly *bad* idea, because it does not work nicely >> when there's more than one SRF in the same targetlist.) It'll probably >> get phased out someday, if we can find a way to replace the >> functionality. I seem to recall speculating that SQL2003's LATERAL >> tables might do the job. > AFAICS, it can be replaced with JOINs: Not really; the case where joins don't help is where you want to generate the SRF's output for each of the values appearing in a table. There's an example in "SQL Functions Returning Sets" in the manual: http://www.postgresql.org/docs/8.1/static/xfunc-sql.html#AEN31646 regards, tom lane