Re: Missing numbers
От
Tom Lane
Тема
Re: Missing numbers
Дата
Msg-id
14247.1117639406@sss.pgh.pa.us
Ответ на
Re: Missing numbers (Simon Riggs)
Список
Дерево обсуждения
Re: Missing numbers Harald Fuchs <use_reply_to@protecting.net>
Re: Missing numbers Simon Riggs <simon@2ndquadrant.com>
Re: Missing numbers Alvaro Herrera <alvherre@surnet.cl>
Re: Missing numbers Simon Riggs <simon@2ndquadrant.com>
Re: Missing numbers Tom Lane <tgl@sss.pgh.pa.us>
Re: Missing numbers josue <josue@lamundial.hn>
Simon Riggs writes: > On Wed, 2005-06-01 at 00:27 -0400, Alvaro Herrera wrote: >>> SELECT g.num >>> FROM generate_series ((SELECT min(doc_numero) FROM bdocs), >>> (SELECT max(doc_numero) FROM bdocs)) AS g(num) >>> LEFT JOIN bdocs ON bdocs.doc_numero = g.num >>> WHERE bdocs.doc_numero IS NULL > I wonder what the SQL spec should happen in this case? It depends upon > whether the NOT NULLs are excluded before or after the join takes > place. The spec says that WHERE is logically applied after the join. In some cases it is possible to push the condition down to occur before the join without changing the results ... but not in the above case. > Either way, I still prefer my phrasing of the SQL, which seems clearer, > but I would say that wouldn't I? Maybe so. The outer-join-and-test-for-null is a pretty common idiom though, so I'd expect experienced SQL programmers to recognize it on sight. regards, tom lane
В списке pgsql-general по дате отправления