Re: [sqlsmith] Failed to generate plan on lateral subqueries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Seltenreich <seltenreich(at)gmx(dot)de>
Cc: David Fetter <david(at)fetter(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [sqlsmith] Failed to generate plan on lateral subqueries
Date: 2015-12-11 00:54:28
Message-ID: 325.1449795268@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Ah-hah --- the new check I added in join_is_legal understood about
> chains of LATERAL references, but it forgot that we could also have chains
> of outer-join ordering constraints. When we're looking to see if joining
> on the basis of a LATERAL reference would break some later outer join, we
> have to look at outer joins to the outer joins' inner relations, too.

> Fixed in the attached. I also stuck all of join_is_legal's
> lateral-related checks inside an "if (root->hasLateralRTEs)" block,
> which will save some time in typical queries with no LATERAL. That
> makes that section of the patch a bit bigger than before, but it's
> mostly just reindentation.

As threatened, here's a patch on top of that that gets rid of
LateralJoinInfo. I'm pretty happy with this, although I have an
itchy feeling that we could dispense with the lateral_vars lists too.

regards, tom lane

Attachment Content-Type Size
remove-lateraljoininfo-1.patch text/x-diff 33.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-12-11 01:03:49 Re: Add IS (NOT) DISTINCT to subquery_Op
Previous Message Jim Nasby 2015-12-11 00:49:52 Add IS (NOT) DISTINCT to subquery_Op