Re: Oddity with NOT IN

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>
Cc: Marko Tiikkaja <marko(at)joh(dot)to>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Oddity with NOT IN
Date: 2016-08-06 17:03:52
Message-ID: CAFj8pRAiR0NHptWawfo6qstHeJek0M095tUV6KUhidkv2sw60A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2016-08-06 18:53 GMT+02:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:

> 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.
>

This can be valid query

Regards

Pavel

> --
> 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
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Nasby 2016-08-06 17:57:26 Re: No longer possible to query catalogs for index capabilities?
Previous Message Jim Nasby 2016-08-06 16:53:53 Re: Oddity with NOT IN