1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-16 15:02:33 +03:00

Fix IS NULL and IS NOT NULL tests on row-valued expressions to conform to

the SQL spec, viz IS NULL is true if all the row's fields are null, IS NOT
NULL is true if all the row's fields are not null.  The former coding got
this right for a limited number of cases with IS NULL (ie, those where it
could disassemble a ROW constructor at parse time), but was entirely wrong
for IS NOT NULL.  Per report from Teodor.

I desisted from changing the behavior for arrays, since on closer inspection
it's not clear that there's any support for that in the SQL spec.  This
probably needs more consideration.
This commit is contained in:
Tom Lane
2006-09-28 20:51:43 +00:00
parent d3aa4a8e33
commit f213131f20
10 changed files with 253 additions and 130 deletions

View File

@@ -10,7 +10,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.115 2006/07/27 19:52:07 tgl Exp $
* $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.116 2006/09/28 20:51:42 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -717,9 +717,12 @@ typedef OpExpr NullIfExpr;
* NullTest
*
* NullTest represents the operation of testing a value for NULLness.
* Currently, we only support scalar input values, but eventually a
* row-constructor input should be supported.
* The appropriate test is performed and returned as a boolean Datum.
*
* NOTE: the semantics of this for rowtype inputs are noticeably different
* from the scalar case. It would probably be a good idea to include an
* "argisrow" flag in the struct to reflect that, but for the moment,
* we do not do so to avoid forcing an initdb during 8.2beta.
* ----------------
*/