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

From Jim Nasby
Subject Re: Oddity with NOT IN
Date
Msg-id 3cc978cd-9f50-dd65-c9c3-fe2d3c19987a@BlueTreble.com
Whole thread Raw
In response to Re: Oddity with NOT IN  (Marko Tiikkaja <marko@joh.to>)
Responses Re: Oddity with NOT IN  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
On 8/4/16 4:53 PM, Marko Tiikkaja wrote:
> On 2016-08-04 11:23 PM, Jim Nasby wrote:
>> I've got a customer that discovered something odd...
>>
>> SELECT f1 FROM v1 WHERE f2 not in (SELECT bad FROM v2 WHERE f3 = 1);
>>
>> does not error, even though bad doesn't exist, but
>
> I'm guessing there's a v1.bad?
>
> This is a common mistake, and also why I recommend always table
> qualifying column references when there's more than one table in scope.

Well now I feel dumb...

It would be very useful if we had some way to warn users about stuff 
like this. Emitting a NOTICE comes to mind.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
855-TREBLE2 (855-873-2532)   mobile: 512-569-9461



pgsql-hackers by date:

Previous
From: Andrew Borodin
Date:
Subject: Re: Re: GiST optimizing memmoves in gistplacetopage for fixed-size updates [PoC]
Next
From: Pavel Stehule
Date:
Subject: Re: Oddity with NOT IN