Quantcast
Channel: Planet PostgreSQL
Viewing all articles
Browse latest Browse all 9843

Bruce Momjian: The Three-Valued Logic of NULLs (Part 4/11)

$
0
0

NULLs exist in a three-valued logic system, which frankly sounds scary. A two-valued logic system, where things are either true or false, is very easy to understand. Three-valued logic sounds like something is wrong, and in an sense something is wrong because it injects uncertainty (NULL) into a logic system which normally only handles certainty. This is like the flat-nose pliers I mentioned earlier— ideally we could do everything with two-valued logic, but there are cases where three-valued logic, like pliers, is necessary, and we have to be able to deal with such cases:

SELECT NULL = 1;
 ?column?
----------
 (null)
 
SELECT NULL = '';
 ?column?
----------
 (null)
 
SELECT NULL = NULL;
 ?column?
----------
 (null)
 
SELECT NULL < NULL + 1;
 ?column?
----------
 (null)

Continue Reading »


Viewing all articles
Browse latest Browse all 9843

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>