Re: [GENERAL] postgresql how to duplicate rows in result. - Mailing list pgsql-general

From Merlin Moncure
Subject Re: [GENERAL] postgresql how to duplicate rows in result.
Date
Msg-id CAHyXU0wU=g+fCSF9D8NpboeH=uaw7yOo=TzL2jCsQwCiGyQuDA@mail.gmail.com
Whole thread Raw
In response to Re: [GENERAL] postgresql how to duplicate rows in result.  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: [GENERAL] postgresql how to duplicate rows in result.  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Thu, Feb 16, 2017 at 10:27 AM, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> If it wasn't lateral the reference to number in "generate_series(1, number)"
> would fail.

huh -- I didn't know that!  Testing it out, all JOIN types imply
LATERAL if the function call is tlist SRF style (which is pretty werid
IMO)  I tend to avoid optional words (with the important exception of
AS for column list renames) but I think it's a good idea to disclose
LATERAL in this case.  It's a big clue to the reader what is going on
and the expanded form:

SELECT foo.* FROM foo CROSS JOIN LATERAL (SELECT a,b FROM func(foo.bar)) q;

... requires LATERAL to be explicitly stated.  This form is more
general since it can be cleanly used when func() returns more than one
column.

merlin


pgsql-general by date:

Previous
From: Alexey Lesovsky
Date:
Subject: [GENERAL] save PGresult to file.
Next
From: Jeff Janes
Date:
Subject: Re: [GENERAL] Bad planning data resulting in OOM killing of postgres