Proposal: revert behavior of IS NULL on row types - Mailing list pgsql-hackers

From Andrew Gierth
Subject Proposal: revert behavior of IS NULL on row types
Date
Msg-id 87vazxqpdb.fsf@news-spur.riddles.org.uk
Whole thread Raw
Responses Re: Proposal: revert behavior of IS NULL on row types  ("David G. Johnston" <david.g.johnston@gmail.com>)
Re: Proposal: revert behavior of IS NULL on row types  (Peter Eisentraut <peter.eisentraut@2ndquadrant.com>)
List pgsql-hackers
In light of the fact that it is an endless cause of bugs both in pg and
potentially to applications, I propose that we cease attempting to
conform to the spec's definition of IS NULL in favour of the following
rules:

1. x IS NULL  is true if and only if x has the null value (isnull set).

2. x IS NOT NULL  if and only if  NOT (x IS NULL)

3. ROW() and other row constructors never return the null value.
Whole-row vars when constructed never contain the null value. 

4. Columns or variables of composite type can (if not declared NOT NULL)
contain the null value (isnull set) which is distinct from an
all-columns-null value.

5. COALESCE(x,y) continues to return y if and only if x is the null
value. (We currently violate the spec here.)

(X. Optionally, consider adding new predicates:
 x IS ALL NULL x IS NOT ALL NULL x IS ALL NOT NULL x IS NOT ALL NOT NULL

which would examine the fields of x non-recursively.)

Justification:

https://www.postgresql.org/message-id/4f6a90a0-c6e8-22eb-3b7a-727f8a60f3b1%40BlueTreble.com
https://www.postgresql.org/message-id/20160708024746.1410.57282%40wrigleys.postgresql.org

Further rationale:

https://www.postgresql.org/message-id/87zip9qti4.fsf%40news-spur.riddles.org.uk

-- 
Andrew (irc:RhodiumToad)



pgsql-hackers by date:

Previous
From: Chapman Flack
Date:
Subject: AdvanceXLInsertBuffer vs. WAL segment compressibility
Next
From: "David G. Johnston"
Date:
Subject: Re: Proposal: revert behavior of IS NULL on row types