Re: [HACKERS] LATERAL, UNNEST and spec compliance

2013-01-25 Thread Tom Lane
David Fetter writes: > Please find attached a patch which implements approach 3. The vast > majority of it is changes to the regression tests. The removed > regression tests in join.{sql,out} are no longer errors, although some > of them are pretty standard DoS attacks, hence they're all removed

Re: [HACKERS] LATERAL, UNNEST and spec compliance

2013-01-25 Thread Tom Lane
Stephen Frost writes: > * Tom Lane (t...@sss.pgh.pa.us) wrote: >> SELECT ... FROM a WHERE a.x IN (SELECT ... FROM b, srf(y) WHERE ...) > Actually, this appears to fail already, at least in 9.2.2: > => select * from (values (1)) v(a) where v.a in (select x from (values (2)) > v2(a), > ->

Re: [HACKERS] LATERAL, UNNEST and spec compliance

2013-01-25 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > SELECT ... FROM a WHERE a.x IN (SELECT ... FROM b, srf(y) WHERE ...) Actually, this appears to fail already, at least in 9.2.2: => select * from (values (1)) v(a) where v.a in (select x from (values (2)) v2(a), -> generate_series(1,a)

Re: [HACKERS] LATERAL, UNNEST and spec compliance

2013-01-25 Thread Stephen Frost
* Tom Lane (t...@sss.pgh.pa.us) wrote: > However ... David is wrong to claim that it's zero-risk. It's true that > an SRF can't contain any side-references today, but it can contain an > outer reference. Consider a case like > > SELECT ... FROM a WHERE a.x IN (SELECT ... FROM b, srf(y) WHERE ...

Re: [HACKERS] LATERAL, UNNEST and spec compliance

2013-01-25 Thread Tom Lane
Stephen Frost writes: > * David Fetter (da...@fetter.org) wrote: >> 3. Make all cases of SRFs in the FROM-clause implicitly LATERAL. >> >> (As far as I can tell, those cases whose behaviour would be changed by >> this actually produce errors in versions prior to 9.3, so no working >> code should

Re: [HACKERS] LATERAL, UNNEST and spec compliance

2013-01-25 Thread Stephen Frost
* David Fetter (da...@fetter.org) wrote: > As I see it, the current options are: > > 1. Do nothing, and insist on non-standard use of the LATERAL keyword. I'm not a big fan of this. Providing a good error message saying "you need to use LATERAL for this query to work" makes it slightly better, b

Re: [HACKERS] LATERAL, UNNEST and spec compliance

2013-01-25 Thread David Fetter
On Thu, Jan 24, 2013 at 09:12:41PM -0800, David Fetter wrote: > On Thu, Jan 24, 2013 at 09:51:46AM -0800, David Fetter wrote: > > Folks, > > > > Andrew Gierth asked me to send this out as his email is in a parlous > > state at the moment. My comments will follow in replies. Without > > further a