Re: Allowing NOT IN to use ANTI joins
Simon Riggs <simon@2ndquadrant.com>
From: Simon Riggs <simon@2ndQuadrant.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Marti Raudsepp <marti@juffo.org>,
PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2014-06-26T10:00:26Z
Lists: pgsql-hackers
On 26 June 2014 10:31, David Rowley <dgrowleyml@gmail.com> wrote: > If there's no way to tell that the target entry comes from a left join, then > would it be a bit too quirky to just do the NOT NULL checking when > list_length(query->rtable) == 1 ? or maybe even loop over query->rtable and > abort if we find an outer join type? it seems a bit hackish, but perhaps it > would please more people than it would surprise. We don't know enough about joins at present, so we only allow it when there are no joins (i.e. length == 1). That's just a statement of reality, not a hack. I would agree with Tom that the common usage is to do NOT IN against a table with no where clause, so this would hit the most frequent use case. Maybe Tom will have a flash of insight before commit, or maybe we figure out a way to extend it later. Let's document it and move on. -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services