Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-21 Thread Tom Lane
Merlin Moncure writes: > On Thu, Feb 16, 2017 at 10:27 AM, David G. Johnston > 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

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-21 Thread Merlin Moncure
On Thu, Feb 16, 2017 at 10:27 AM, David G. Johnston 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

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-16 Thread David G. Johnston
On Thu, Feb 16, 2017 at 9:16 AM, Steve Crawford < scrawf...@pinpointresearch.com> wrote: > For my enlightenment, why use LATERAL here? I get the same result with a > simple CROSS JOIN (though overall I like the clever solution). > > ​To be explicit, I think. CROSS JOIN function() implies lateral

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-16 Thread Steve Crawford
For my enlightenment, why use LATERAL here? I get the same result with a simple CROSS JOIN (though overall I like the clever solution). Cheers, Steve On Thu, Feb 16, 2017 at 12:11 AM, Alessandro Baggi < alessandro.ba...@gmail.com> wrote: > Il 15/02/2017 19:11, Alessandro Baggi ha scritto: > >>

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-16 Thread Alessandro Baggi
Il 15/02/2017 19:11, Alessandro Baggi ha scritto: Il 14/02/2017 21:51, Merlin Moncure ha scritto: On Tue, Feb 14, 2017 at 12:36 PM, Merlin Moncure wrote: On Tue, Feb 14, 2017 at 12:04 PM, Alessandro Baggi wrote: Hi list, sorry for my english,

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-15 Thread Alessandro Baggi
Il 14/02/2017 21:51, Merlin Moncure ha scritto: On Tue, Feb 14, 2017 at 12:36 PM, Merlin Moncure wrote: On Tue, Feb 14, 2017 at 12:04 PM, Alessandro Baggi wrote: Hi list, sorry for my english, I will try to example as well. I've a query that

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-14 Thread John McKown
On Tue, Feb 14, 2017 at 2:50 PM, Merlin Moncure wrote: > ​ > > > IMO, lateral join (available as of 9.3) is faster and simpler. > ​And, nicely, I've learned something new. I've never used a LATERAL join before. Interesting.​ > > merlin > -- "Irrigation of the land

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-14 Thread Merlin Moncure
On Tue, Feb 14, 2017 at 12:36 PM, Merlin Moncure wrote: > On Tue, Feb 14, 2017 at 12:04 PM, Alessandro Baggi > wrote: >> Hi list, >> sorry for my english, I will try to example as well. I've a query that joins >> multiple tables and return a result

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-14 Thread Merlin Moncure
On Tue, Feb 14, 2017 at 12:42 PM, John McKown wrote: > On Tue, Feb 14, 2017 at 12:04 PM, Alessandro Baggi > wrote: >> >> Hi list, >> sorry for my english, I will try to example as well. I've a query that >> joins multiple tables and

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-14 Thread John McKown
On Tue, Feb 14, 2017 at 12:04 PM, Alessandro Baggi < alessandro.ba...@gmail.com> wrote: > Hi list, > sorry for my english, I will try to example as well. I've a query that > joins multiple tables and return a result like: > > > ​​ > id,customers,phone,code,number > 1 , ,3,123 , 2 > 2

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-14 Thread Merlin Moncure
On Tue, Feb 14, 2017 at 12:04 PM, Alessandro Baggi wrote: > Hi list, > sorry for my english, I will try to example as well. I've a query that joins > multiple tables and return a result like: > > id,customers,phone,code,number > 1 , ,3,123 , 2 > 2 ,

Re: [GENERAL] postgresql how to duplicate rows in result.

2017-02-14 Thread Melvin Davidson
On Tue, Feb 14, 2017 at 1:04 PM, Alessandro Baggi < alessandro.ba...@gmail.com> wrote: > Hi list, > sorry for my english, I will try to example as well. I've a query that > joins multiple tables and return a result like: > > > id,customers,phone,code,number > 1 , ,3,123 , 2 > 2 ,

[GENERAL] postgresql how to duplicate rows in result.

2017-02-14 Thread Alessandro Baggi
Hi list, sorry for my english, I will try to example as well. I've a query that joins multiple tables and return a result like: id,customers,phone,code,number 1 , ,3,123 , 2 2 , aassdsds,33322,211 , 1 3 , ,21221,221 , 1 I need, where "number" field is > 1, to duplicate