Re: Oddity with NOT IN

Поиск
Список
Период
Сортировка
От Andrew Gierth
Тема Re: Oddity with NOT IN
Дата
Msg-id 87oa55dc1l.fsf@news-spur.riddles.org.uk
обсуждение исходный текст
Ответ на Re: Oddity with NOT IN  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: Oddity with NOT IN  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Re: Oddity with NOT IN  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Список pgsql-hackers
>>>>> "Pavel" == Pavel Stehule <pavel.stehule@gmail.com> writes:
>> Well now I feel dumb...>> >> It would be very useful if we had some way to warn users about stuff>> like this.
Emittinga NOTICE comes to mind.
 
Pavel> This can be valid query

It can be, but it essentially never is. The cases where you genuinely
want a correlated IN query are rare, but even then there would be
something in the targetlist that referenced the inner query.

The easy to catch case, I think, is when the targetlist of the IN or NOT
IN subquery contains vars of the outer query level but no vars of the
inner one and no volatile functions. This can be checked for with a
handful of lines in the parser or a couple of dozen lines in a plugin
module (though one would have to invent an error code, none of the
existing WARNING sqlstates would do).

Maybe David Fetter's suggested module for catching missing WHERE clauses
could be expanded into a more general SQL-'Lint' module?

-- 
Andrew (irc:RhodiumToad)



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: No longer possible to query catalogs for index capabilities?
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: Oddity with NOT IN