From: | Antonin Houska <antonin(dot)houska(at)gmail(dot)com> |
---|---|
To: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Reference to parent query from ANY sublink |
Date: | 2013-10-31 15:46:25 |
Message-ID: | 52727B51.1090609@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
So far, a suquery of ANY sublink located in WHERE/ON clause can't
reference vars exactly one level up, as long as pull-up into the join
tree is expected. Now that we have LATERAL subqueries (there seem to be
no specifics of SEMI JOIN when it comes to parameterization etc), I
think this restriction can be lifted. Thus a subplan should be avoided
often.
Not sure if something like that is applicable to EXISTS: various parts
are cut-off, so there are probably no vars having (varlevelsup == 1).
The attachments show cases where the SEMI JOIN should be inserted above
INNER JOIN and into the nullable side of OUTER JOIN respectively, each
before the patch is applied and after that.
So far I didn't test recursive processing, but don't expect problems here.
Can the change be as simple as this or do I neglect anything?
// Antonin Houska (Tony)
Attachment | Content-Type | Size |
---|---|---|
lateral_semijoin.patch | text/x-patch | 1.3 KB |
any_01.sql | text/x-sql | 80 bytes |
any_01_before | text/plain | 325 bytes |
any_01_after | text/plain | 500 bytes |
any_02.sql | text/x-sql | 127 bytes |
any_02_before | text/plain | 577 bytes |
any_02_after | text/plain | 802 bytes |
tables.ddl | text/plain | 65 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Love | 2013-10-31 16:04:57 | Feature request: optimizer improvement |
Previous Message | Teodor Sigaev | 2013-10-31 15:07:42 | SP-GiST bug and fix |