Thread: pgsql: Fix IS NULL and IS NOT NULL tests on row-valued expressions to

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

From
tgl@postgresql.org (Tom Lane)
Date:
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/doc/src/sgml:
        func.sgml (r1.340 -> r1.341)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/func.sgml.diff?r1=1.340&r2=1.341)
    pgsql/src/backend/executor:
        execQual.c (r1.193 -> r1.194)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/execQual.c.diff?r1=1.193&r2=1.194)
    pgsql/src/backend/optimizer/util:
        clauses.c (r1.220 -> r1.221)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/clauses.c.diff?r1=1.220&r2=1.221)
        predtest.c (r1.8 -> r1.9)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/util/predtest.c.diff?r1=1.8&r2=1.9)
    pgsql/src/backend/parser:
        gram.y (r2.565 -> r2.566)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/parser/gram.y.diff?r1=2.565&r2=2.566)
    pgsql/src/backend/utils/cache:
        lsyscache.c (r1.136 -> r1.137)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/cache/lsyscache.c.diff?r1=1.136&r2=1.137)
    pgsql/src/include/nodes:
        execnodes.h (r1.160 -> r1.161)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/execnodes.h.diff?r1=1.160&r2=1.161)
        nodes.h (r1.187 -> r1.188)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/nodes.h.diff?r1=1.187&r2=1.188)
        primnodes.h (r1.115 -> r1.116)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/nodes/primnodes.h.diff?r1=1.115&r2=1.116)
    pgsql/src/include/utils:
        lsyscache.h (r1.105 -> r1.106)
        (http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/utils/lsyscache.h.diff?r1=1.105&r2=1.106)

Re: pgsql: Fix IS NULL and IS NOT NULL tests on row-valued

From
Teodor Sigaev
Date:
9.17.5. Row-wise Comparison
"These constructs test a row value for null or not null. A row value is
considered not null if it has at least one field that is not null."

I suppose, it should be changed too.

Tom Lane wrote:
> 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
--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/

Re: pgsql: Fix IS NULL and IS NOT NULL tests on row-valued expressions to

From
Tom Lane
Date:
Teodor Sigaev <teodor@sigaev.ru> writes:
> 9.17.5. Row-wise Comparison
> "These constructs test a row value for null or not null. A row value is
> considered not null if it has at least one field that is not null."

Wups, I missed that part of the docs, will fix.  Thanks.

            regards, tom lane