<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: NULLs vs. NOT IN()</title>
	<atom:link href="http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/</link>
	<description></description>
	<lastBuildDate>Mon, 06 Sep 2010 15:06:06 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: raford</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26571</link>
		<dc:creator>raford</dc:creator>
		<pubDate>Thu, 28 Aug 2008 07:24:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26571</guid>
		<description>Very helpful. I spent long time to get rid of this case, and found your advice.
Really thanks a lot for your trouble to find and explain all things.
Thanks.</description>
		<content:encoded><![CDATA[<p>Very helpful. I spent long time to get rid of this case, and found your advice.<br />
Really thanks a lot for your trouble to find and explain all things.<br />
Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: szeryf</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26548</link>
		<dc:creator>szeryf</dc:creator>
		<pubDate>Thu, 21 Aug 2008 18:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26548</guid>
		<description>maybe it&#039;s best to think of NULL as NULL in a three-value logic and not try to bend it into two-value logic because that&#039;s what causes all the alleged anomalies :)</description>
		<content:encoded><![CDATA[<p>maybe it&#8217;s best to think of NULL as NULL in a three-value logic and not try to bend it into two-value logic because that&#8217;s what causes all the alleged anomalies <img src='http://www.depesz.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deyan Dyankov</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26536</link>
		<dc:creator>Deyan Dyankov</dc:creator>
		<pubDate>Mon, 18 Aug 2008 13:50:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26536</guid>
		<description>Featuring Oracle 10gR2 ..

SQL&gt; SELECT &#039;yes&#039; AS hehe FROM DUAL WHERE &#039;&#039; IS NULL;
 
HEHE
--------------------------------
yes
 
SQL&gt;</description>
		<content:encoded><![CDATA[<p>Featuring Oracle 10gR2 ..</p>
<p>SQL&gt; SELECT &#8216;yes&#8217; AS hehe FROM DUAL WHERE &#8221; IS NULL;</p>
<p>HEHE<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
yes</p>
<p>SQL&gt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MikeEnRegalia</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26535</link>
		<dc:creator>MikeEnRegalia</dc:creator>
		<pubDate>Mon, 18 Aug 2008 10:27:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26535</guid>
		<description>Maybe it&#039;s better to think of NULL as *undefined*. The aggregate sum() returns NULL if the relation doesn&#039;t have any tuples, and it&#039;s correct IMO. Still, developers are drawing conclusions from this undefined return value, like in this case: sum() returns NULL -&gt; relation is empty. 

As far as the example is concerned:

SELECT * FROM objects WHERE id NOT IN (SELECT object_id FROM secondary)

Why not write it as

SELECT * FROM objects WHERE id NOT IN (SELECT object_id FROM secondary WHERE object_id IS NOT NULL)

This avoids the problem, doesn&#039;t it?</description>
		<content:encoded><![CDATA[<p>Maybe it&#8217;s better to think of NULL as *undefined*. The aggregate sum() returns NULL if the relation doesn&#8217;t have any tuples, and it&#8217;s correct IMO. Still, developers are drawing conclusions from this undefined return value, like in this case: sum() returns NULL -&gt; relation is empty. </p>
<p>As far as the example is concerned:</p>
<p>SELECT * FROM objects WHERE id NOT IN (SELECT object_id FROM secondary)</p>
<p>Why not write it as</p>
<p>SELECT * FROM objects WHERE id NOT IN (SELECT object_id FROM secondary WHERE object_id IS NOT NULL)</p>
<p>This avoids the problem, doesn&#8217;t it?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: depesz</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26531</link>
		<dc:creator>depesz</dc:creator>
		<pubDate>Sat, 16 Aug 2008 18:44:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26531</guid>
		<description>@Jeff Davis:
Hmm, I&#039;m not sure if I can support the idea that it is not logical.

ad. 1: perhaps it is badly named, but there is nowhere claim that &quot;+&quot; should work the same as sum() which is aggregate. the moment you know that aggregates ignore nulls, there are no surprises.

ad. 2: no, it is not false. sql logic is based on not 2, but 3 values. something that isn&#039;t true doesn&#039;t have to be false. &quot;where&quot; need condition that evaluates to &quot;true&quot;. anything else is rejected. it doesn&#039;t mean in any way that null = false, as this: &quot;select 1 where not null&quot; still doesn&#039;t return any rows, and if it was the case you described - it would.

ad. 3: basically the same thing as with &quot;where&quot;, but checks are checked for *false* value. again. something that isn&#039;t true doesn&#039;t mean it&#039;s false.

and again - 3 value logic works quite well when you&#039;ll assume null to be &quot;unknown&quot;.

where - requires &quot;true&quot;, not something that we don&#039;t know or something that we know is false.
check - it stops entering &quot;false&quot; values, but if it is not definitely false - it can be inserted. it might be &quot;true&quot;. it might be simply &quot;unknown&quot;. but it&#039;s not &quot;false&quot;.</description>
		<content:encoded><![CDATA[<p>@Jeff Davis:<br />
Hmm, I&#8217;m not sure if I can support the idea that it is not logical.</p>
<p>ad. 1: perhaps it is badly named, but there is nowhere claim that &#8220;+&#8221; should work the same as sum() which is aggregate. the moment you know that aggregates ignore nulls, there are no surprises.</p>
<p>ad. 2: no, it is not false. sql logic is based on not 2, but 3 values. something that isn&#8217;t true doesn&#8217;t have to be false. &#8220;where&#8221; need condition that evaluates to &#8220;true&#8221;. anything else is rejected. it doesn&#8217;t mean in any way that null = false, as this: &#8220;select 1 where not null&#8221; still doesn&#8217;t return any rows, and if it was the case you described &#8211; it would.</p>
<p>ad. 3: basically the same thing as with &#8220;where&#8221;, but checks are checked for *false* value. again. something that isn&#8217;t true doesn&#8217;t mean it&#8217;s false.</p>
<p>and again &#8211; 3 value logic works quite well when you&#8217;ll assume null to be &#8220;unknown&#8221;.</p>
<p>where &#8211; requires &#8220;true&#8221;, not something that we don&#8217;t know or something that we know is false.<br />
check &#8211; it stops entering &#8220;false&#8221; values, but if it is not definitely false &#8211; it can be inserted. it might be &#8220;true&#8221;. it might be simply &#8220;unknown&#8221;. but it&#8217;s not &#8220;false&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Davis</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26530</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Fri, 15 Aug 2008 22:34:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26530</guid>
		<description>@depesz:

1. null as no value:

If you select the SUM of a table (or group or subselect) and there are no input tuples, it returns NULL. Clearly this is not unknown, because your source data contains no NULLs. If you know everything, how can the results of a query be unknown?

Also, with outer join, how can outer join produce &quot;unknown&quot; when there are no NULLs in your source data? 

And as a final observation: if you SUM() a column with NULLs in it in addition to integers, the NULLs will be ignored, and it will produce a value (if NULLs are unknown, clearly it&#039;s wrong to count them as zero). Thus, as I point out in my slides, SUM() of NULL and 1 is 1, but NULL + 1 is NULL.

2. NULL is clearly false in a WHERE clause:
SELECT 1;
SELECT 1 WHERE NULL; -- same as &quot;WHERE FALSE&quot;

3. Add a &quot;CHECK (NULL)&quot; as a constraint. It will not reject anything, and is therefore equivalent to &quot;CHECK (TRUE)&quot;.</description>
		<content:encoded><![CDATA[<p>@depesz:</p>
<p>1. null as no value:</p>
<p>If you select the SUM of a table (or group or subselect) and there are no input tuples, it returns NULL. Clearly this is not unknown, because your source data contains no NULLs. If you know everything, how can the results of a query be unknown?</p>
<p>Also, with outer join, how can outer join produce &#8220;unknown&#8221; when there are no NULLs in your source data? </p>
<p>And as a final observation: if you SUM() a column with NULLs in it in addition to integers, the NULLs will be ignored, and it will produce a value (if NULLs are unknown, clearly it&#8217;s wrong to count them as zero). Thus, as I point out in my slides, SUM() of NULL and 1 is 1, but NULL + 1 is NULL.</p>
<p>2. NULL is clearly false in a WHERE clause:<br />
SELECT 1;<br />
SELECT 1 WHERE NULL; &#8212; same as &#8220;WHERE FALSE&#8221;</p>
<p>3. Add a &#8220;CHECK (NULL)&#8221; as a constraint. It will not reject anything, and is therefore equivalent to &#8220;CHECK (TRUE)&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: depesz</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26529</link>
		<dc:creator>depesz</dc:creator>
		<pubDate>Fri, 15 Aug 2008 20:51:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26529</guid>
		<description>@Jeff Davis:
sorry, bad wording. not &quot;didn&#039;t found there any examples&quot;, but &quot;any examples regarding these cases&quot;.

btw. i swear that wordpress once had the ability to edit comments, but it seems to be gone now.</description>
		<content:encoded><![CDATA[<p>@Jeff Davis:<br />
sorry, bad wording. not &#8220;didn&#8217;t found there any examples&#8221;, but &#8220;any examples regarding these cases&#8221;.</p>
<p>btw. i swear that wordpress once had the ability to edit comments, but it seems to be gone now.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: depesz</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26528</link>
		<dc:creator>depesz</dc:creator>
		<pubDate>Fri, 15 Aug 2008 20:49:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26528</guid>
		<description>@Jeff Davis:
I saw the slides, but I didn&#039;t found there any examples.

If you could write examples on:
1. null as no value in case of outer join
2. null as false in where
3. null as true in constraints

I&#039;m not arguing with your points - I would just like to see some justification for the points, because I can&#039;t find any examples in my memory, and the only example left (no value in aggregates) is easily explainable by the fact that aggregates should skip null values.

As far as I recall, this &quot;skip nulls in aggregates&quot; comes from standard, but I might be wrong.</description>
		<content:encoded><![CDATA[<p>@Jeff Davis:<br />
I saw the slides, but I didn&#8217;t found there any examples.</p>
<p>If you could write examples on:<br />
1. null as no value in case of outer join<br />
2. null as false in where<br />
3. null as true in constraints</p>
<p>I&#8217;m not arguing with your points &#8211; I would just like to see some justification for the points, because I can&#8217;t find any examples in my memory, and the only example left (no value in aggregates) is easily explainable by the fact that aggregates should skip null values.</p>
<p>As far as I recall, this &#8220;skip nulls in aggregates&#8221; comes from standard, but I might be wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Davis</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26527</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Fri, 15 Aug 2008 20:20:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26527</guid>
		<description>Also, I wrote up something about NULLs on my blog as well, just before depesz:
http://people.planetpostgresql.org/jdavis/index.php?/archives/9-None,-nil,-Nothing,-undef,-NA,-and-SQL-NULL.html</description>
		<content:encoded><![CDATA[<p>Also, I wrote up something about NULLs on my blog as well, just before depesz:<br />
<a href="http://people.planetpostgresql.org/jdavis/index.php?/archives/9-None,-nil,-Nothing,-undef,-NA,-and-SQL-NULL.html" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/people.planetpostgresql.org/jdavis/index.php?/archives/9-None_-nil_-Nothing_-undef_-NA_-and-SQL-NULL.html&amp;referer=');">http://people.planetpostgresql.org/jdavis/index.php?/archives/9-None,-nil,-Nothing,-undef,-NA,-and-SQL-NULL.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeff Davis</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26526</link>
		<dc:creator>Jeff Davis</dc:creator>
		<pubDate>Fri, 15 Aug 2008 20:17:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26526</guid>
		<description>@depesz:
&quot;when you remember to see nulls like *unknown* - everything makes sense&quot;

That&#039;s not true. See my slides from this talk:

http://www.pgcon.org/2008/schedule/events/83.en.html

Sometimes NULL is treated like unknown (operators, functions, [NOT] IN), sometimes it&#039;s treated like no value at all (aggregates and outer joins), sometimes it&#039;s treated like false (WHERE clause), and sometimes it&#039;s treated like true (constraints).

These inconsistencies can lead to very unintuitive results.</description>
		<content:encoded><![CDATA[<p>@depesz:<br />
&#8220;when you remember to see nulls like *unknown* &#8211; everything makes sense&#8221;</p>
<p>That&#8217;s not true. See my slides from this talk:</p>
<p><a href="http://www.pgcon.org/2008/schedule/events/83.en.html" rel="nofollow" onclick="pageTracker._trackPageview('/outgoing/www.pgcon.org/2008/schedule/events/83.en.html?referer=');">http://www.pgcon.org/2008/schedule/events/83.en.html</a></p>
<p>Sometimes NULL is treated like unknown (operators, functions, [NOT] IN), sometimes it&#8217;s treated like no value at all (aggregates and outer joins), sometimes it&#8217;s treated like false (WHERE clause), and sometimes it&#8217;s treated like true (constraints).</p>
<p>These inconsistencies can lead to very unintuitive results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26525</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Fri, 15 Aug 2008 18:48:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26525</guid>
		<description>@despez:

In all recent versions of Oracle (maybe every version) NULL becomes &#039;&#039; when Oracle thinks it needs to and &#039;&#039; becomes NULL always.


In Oracle:


select count(*) from dual where &#039;&#039; is null;

...returns 1 (dual is an Oracle-standard one row table)


select &#039;abc&#039;&#124;&#124;null&#124;&#124;&#039;123&#039; from dual;

...returns &#039;abc123&#039;


select length(&#039;&#039;) from dual;

...returns NULL


If Oracle followed the standard, the first query would return 0 no matter how many rows dual had, the second would return null, and the third would return 0. These non-standard behaviors are so well entrenched in the Oracle world that I doubt they will change anytime soon.</description>
		<content:encoded><![CDATA[<p>@despez:</p>
<p>In all recent versions of Oracle (maybe every version) NULL becomes &#8221; when Oracle thinks it needs to and &#8221; becomes NULL always.</p>
<p>In Oracle:</p>
<p>select count(*) from dual where &#8221; is null;</p>
<p>&#8230;returns 1 (dual is an Oracle-standard one row table)</p>
<p>select &#8216;abc&#8217;||null||&#8217;123&#8242; from dual;</p>
<p>&#8230;returns &#8216;abc123&#8242;</p>
<p>select length(&#8221;) from dual;</p>
<p>&#8230;returns NULL</p>
<p>If Oracle followed the standard, the first query would return 0 no matter how many rows dual had, the second would return null, and the third would return 0. These non-standard behaviors are so well entrenched in the Oracle world that I doubt they will change anytime soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26522</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Thu, 14 Aug 2008 15:53:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26522</guid>
		<description>I have found that, in all cases, the best method is to perform an outer join and use IS NULL on the &quot;not in&quot; table. It seems to optimize much better, though it takes a bit more time and though to write the query in an ad hoc fashion. This also ensures you&#039;re not running into any gotchas like this.</description>
		<content:encoded><![CDATA[<p>I have found that, in all cases, the best method is to perform an outer join and use IS NULL on the &#8220;not in&#8221; table. It seems to optimize much better, though it takes a bit more time and though to write the query in an ad hoc fashion. This also ensures you&#8217;re not running into any gotchas like this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Treat</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26521</link>
		<dc:creator>Robert Treat</dc:creator>
		<pubDate>Wed, 13 Aug 2008 17:42:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26521</guid>
		<description>Don&#039;t forget, you can often rewrite IN queries to use the EXISTS clause, which might perform a little more to your liking. 

pagila=# SELECT * FROM objects WHERE exists (SELECT object_id FROM secondary where object_id = id);
 id
----
  2
(1 row)

pagila=# SELECT * FROM objects WHERE not exists (SELECT object_id FROM secondary where object_id = id);
 id
----
  1
  3
(2 rows)</description>
		<content:encoded><![CDATA[<p>Don&#8217;t forget, you can often rewrite IN queries to use the EXISTS clause, which might perform a little more to your liking. </p>
<p>pagila=# SELECT * FROM objects WHERE exists (SELECT object_id FROM secondary where object_id = id);<br />
 id<br />
&#8212;-<br />
  2<br />
(1 row)</p>
<p>pagila=# SELECT * FROM objects WHERE not exists (SELECT object_id FROM secondary where object_id = id);<br />
 id<br />
&#8212;-<br />
  1<br />
  3<br />
(2 rows)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: GiM</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26520</link>
		<dc:creator>GiM</dc:creator>
		<pubDate>Wed, 13 Aug 2008 17:00:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26520</guid>
		<description>I&#039;ve already stumbled upon this few times so I knew what it&#039;ll be about after title itself, I quite agree with shane, when you take a look at it is very reasonable.
But there is simialar thing when using ALL (at least in Oracle didn&#039;t tested other dbs), that
lately confused me.
using the following to selects yields different results because &#039;tbl&#039; contain NULL values

SELECT name FROM tbl WHERE value &gt; ALL (SELECT value FROM tbl WHERE fltr=&#039;Blah&#039;);

SELECT name FROM tbl WHERE value &gt; (SELECT max(value) from tbl WHERE fltr=&#039;Blah&#039;);</description>
		<content:encoded><![CDATA[<p>I&#8217;ve already stumbled upon this few times so I knew what it&#8217;ll be about after title itself, I quite agree with shane, when you take a look at it is very reasonable.<br />
But there is simialar thing when using ALL (at least in Oracle didn&#8217;t tested other dbs), that<br />
lately confused me.<br />
using the following to selects yields different results because &#8216;tbl&#8217; contain NULL values</p>
<p>SELECT name FROM tbl WHERE value &gt; ALL (SELECT value FROM tbl WHERE fltr=&#8217;Blah&#8217;);</p>
<p>SELECT name FROM tbl WHERE value &gt; (SELECT max(value) from tbl WHERE fltr=&#8217;Blah&#8217;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Cheng</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26519</link>
		<dc:creator>Daniel Cheng</dc:creator>
		<pubDate>Wed, 13 Aug 2008 16:15:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26519</guid>
		<description>Oracle never make  NULL = &#039;&#039;,
they make 
 &#039;&#039;=&#039;&#039;  --&gt; NULL
 &#039;&#039; IS NULL --&gt; True</description>
		<content:encoded><![CDATA[<p>Oracle never make  NULL = &#8221;,<br />
they make<br />
 &#8221;=&#8221;  &#8211;&gt; NULL<br />
 &#8221; IS NULL &#8211;&gt; True</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: depesz</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26518</link>
		<dc:creator>depesz</dc:creator>
		<pubDate>Wed, 13 Aug 2008 15:21:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26518</guid>
		<description>@Shane:
Unfortunately not all RDBMSes work this way.
I&#039;m sure at least some versions of oracle (i haven&#039;t used it in years) made NULL = &#039;&#039;.
I&#039;m also sure, that not only Oracle did something with NULLs that is against standard.</description>
		<content:encoded><![CDATA[<p>@Shane:<br />
Unfortunately not all RDBMSes work this way.<br />
I&#8217;m sure at least some versions of oracle (i haven&#8217;t used it in years) made NULL = &#8221;.<br />
I&#8217;m also sure, that not only Oracle did something with NULLs that is against standard.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shane</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26517</link>
		<dc:creator>Shane</dc:creator>
		<pubDate>Wed, 13 Aug 2008 15:13:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26517</guid>
		<description>Honestly, any developer worth their salt will understand the properties of NULL. NULL is treated the same way in every language and every RDBMS that I&#039;ve encountered in my career. When testing equality, anything tested against NULL returns NULL. 

You did good write-up, and I&#039;m not criticizing you, I&#039;m just saying that there is no bug, there is no issue. This works as expected. 

And if PG changed how this works, THAT would be a problem.</description>
		<content:encoded><![CDATA[<p>Honestly, any developer worth their salt will understand the properties of NULL. NULL is treated the same way in every language and every RDBMS that I&#8217;ve encountered in my career. When testing equality, anything tested against NULL returns NULL. </p>
<p>You did good write-up, and I&#8217;m not criticizing you, I&#8217;m just saying that there is no bug, there is no issue. This works as expected. </p>
<p>And if PG changed how this works, THAT would be a problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: depesz</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26516</link>
		<dc:creator>depesz</dc:creator>
		<pubDate>Wed, 13 Aug 2008 14:28:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26516</guid>
		<description>@Eric:
well, perhaps it&#039;s silly. but it&#039;s the standard. and when you remember to see nulls like *unknown* - everything makes sense.</description>
		<content:encoded><![CDATA[<p>@Eric:<br />
well, perhaps it&#8217;s silly. but it&#8217;s the standard. and when you remember to see nulls like *unknown* &#8211; everything makes sense.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric</title>
		<link>http://www.depesz.com/index.php/2008/08/13/nulls-vs-not-in/comment-page-1/#comment-26515</link>
		<dc:creator>Eric</dc:creator>
		<pubDate>Wed, 13 Aug 2008 14:26:26 +0000</pubDate>
		<guid isPermaLink="false">http://www.depesz.com/?p=1246#comment-26515</guid>
		<description>This seems like really silly behavior.  I can&#039;t think of any use case where NULL should be considered unknown.  NULL means empty as in nothing there.  Therefore, the object.id that do not  equal NULLs in secondary.object_id should be considered NOT IN.

Stated differently, if something is NULL and something has a value (string, int, numeric, etc...) they are clearly not equal by no stretch of any imagination or conjecture so they should be considered NOT IN-cluded in the comparisons.</description>
		<content:encoded><![CDATA[<p>This seems like really silly behavior.  I can&#8217;t think of any use case where NULL should be considered unknown.  NULL means empty as in nothing there.  Therefore, the object.id that do not  equal NULLs in secondary.object_id should be considered NOT IN.</p>
<p>Stated differently, if something is NULL and something has a value (string, int, numeric, etc&#8230;) they are clearly not equal by no stretch of any imagination or conjecture so they should be considered NOT IN-cluded in the comparisons.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
