Re: Oddity with NOT IN - Mailing list pgsql-hackers

From Andrew Gierth
Subject Re: Oddity with NOT IN
Date
Msg-id 87k2ftdb3e.fsf@news-spur.riddles.org.uk
Whole thread Raw
In response to Re: Oddity with NOT IN  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-hackers
>>>>> "Andrew" == Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
Andrew> The easy to catch case, I think, is when the targetlist of theAndrew> IN or NOT IN subquery contains vars of
theouter query levelAndrew> but no vars of the inner one and no volatile functions. ThisAndrew> can be checked for with
ahandful of lines in the parser or aAndrew> couple of dozen lines in a plugin module (though one would haveAndrew> to
inventan error code, none of the existing WARNING sqlstatesAndrew> would do).
 

Actually thinking about this, if you did it in a module, you'd probably
want to make it an ERROR not a WARNING, because you'd want to actually
stop queries like

delete from t1 where x in (select x from table_with_no_column_x);

rather than let them run.

-- 
Andrew (irc:RhodiumToad)



pgsql-hackers by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: Oddity with NOT IN
Next
From: Jim Nasby
Date:
Subject: Re: Oddity with NOT IN