Re: BUG #12556: Clause IN and NOT IN buggy

From: Kevin Perais <kevin(dot)perais(at)trivia-marketing(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #12556: Clause IN and NOT IN buggy
Date: 2015-01-16 09:17:43
Message-ID: 46C6B6B27EF7AA489BBDF478BF05B5D2BD886818@server.exchange.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

I must disagree with you.

There is enough info to understand what goes wrong. I've run enough queries to inspect data.

The fact that the query with IN does not returns the same result as the JOIN knowing that there are NULL values proves it. Please check the results of all the queries together. You'll see that you do not need data and that the results are incoherent! For the 1st case, I even take a value randomly and I didn't find it in the Account table. So the NOT IN query just can't return 0 as there is at least one value that is not present in the Account table ;)

-----Message d'origine-----
De : Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Envoyé : jeudi 15 janvier 2015 18:05
À : Kevin Perais
Cc : pgsql-bugs(at)postgresql(dot)org
Objet : Re: [BUGS] BUG #12556: Clause IN and NOT IN buggy

kevin(dot)perais(at)trivia-marketing(dot)com writes:
> I've been noticing several times that clauses IN and NOT IN are often buggy.

None of your examples demonstrate any such thing. What's much more likely
is that you've forgotten about NOT IN's weird (but spec-mandated) behavior
with NULLs, and/or misspelled a field name so that the output of the
sub-SELECT is actually an outer reference.

> I'll show you 2 concrete cases to illustrate that.

My idea of a "concrete case" would be something that someone else could
reproduce from the given information, which would certainly require test
data.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message damian 2015-01-16 15:27:13 BUG #12568: upper of int4range unexpected value
Previous Message Josh Berkus 2015-01-16 03:24:40 Re: Partial indexes on VARCHAR get double converted from text