From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Select .... where id not in (....) returns 0 incorrectly
Date: Tue, 5 Apr 2022 19:25:24 -0400
Message-ID: <71a6ae74-79ca-09c6-2e9c-a7f4d86b176f@gmail.com> (raw)
In-Reply-To: <2245474.ElGaqSPkdT@iris>
References: <5820573.lOV4Wx5bFT@iris>
<2ddba2d73d0d54da3396ff2dad9e7d2d@vivaldi.net>
<CAM8SmLWx8b4kZN64wR2iYtQEKuSmYEXS7E42c+D5OPxdyWx9iQ@mail.gmail.com>
<2245474.ElGaqSPkdT@iris>
On 4/4/22 09:21, J. Roeleveld wrote:
> This was actually the case, I forgot there is 1 NULL-value in that list.
> Personally, I think NULL should be treated as a seperate value and not lead to
> strange behaviour.
NULL is strange. Relational databases use ternary, not binary logic. In
the woke vernacular, one could say that Postgres is non-binary. NULL
literally means "no value". It is a part of the standard, so we have to
deal with it, Codd help us. However, based on my lifelong experience
with Oracle, NULL values are bad and are best avoided. Postgres is more
forgiving than Oracle because in Postgres, the condition "is not null"
can be resolved by index. In Oracle, it can not.
--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: gogala.mladen@gmail.com
Subject: Re: Select .... where id not in (....) returns 0 incorrectly
In-Reply-To: <71a6ae74-79ca-09c6-2e9c-a7f4d86b176f@gmail.com>
References: <5820573.lOV4Wx5bFT@iris> <2ddba2d73d0d54da3396ff2dad9e7d2d@vivaldi.net> <CAM8SmLWx8b4kZN64wR2iYtQEKuSmYEXS7E42c+D5OPxdyWx9iQ@mail.gmail.com> <2245474.ElGaqSPkdT@iris> <71a6ae74-79ca-09c6-2e9c-a7f4d86b176f@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox