1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-24 09:27:52 +03:00

Add IS UNKNOWN, IS NOT UNKNOWN boolean tests, fix the existing boolean

tests to return the correct results per SQL9x when given NULL inputs.
Reimplement these tests as well as IS [NOT] NULL to have their own
expression node types, instead of depending on special functions.
From Joe Conway, with a little help from Tom Lane.
This commit is contained in:
Tom Lane
2001-06-19 22:39:12 +00:00
parent 8c30aca2ba
commit 116d2bba7e
18 changed files with 666 additions and 153 deletions

View File

@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.141 2001/05/20 20:28:18 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.142 2001/06/19 22:39:11 tgl Exp $
*
* NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which
@@ -1259,12 +1259,6 @@ _outAExpr(StringInfo str, A_Expr *node)
case NOT:
appendStringInfo(str, "NOT ");
break;
case ISNULL:
appendStringInfo(str, "ISNULL ");
break;
case NOTNULL:
appendStringInfo(str, "NOTNULL ");
break;
case OP:
_outToken(str, node->opname);
appendStringInfo(str, " ");
@@ -1402,6 +1396,32 @@ _outCaseWhen(StringInfo str, CaseWhen *node)
_outNode(str, node->result);
}
/*
* NullTest
*/
static void
_outNullTest(StringInfo str, NullTest *node)
{
appendStringInfo(str, " NULLTEST :arg ");
_outNode(str, node->arg);
appendStringInfo(str, " :nulltesttype %d ",
(int) node->nulltesttype);
}
/*
* BooleanTest
*/
static void
_outBooleanTest(StringInfo str, BooleanTest *node)
{
appendStringInfo(str, " BOOLEANTEST :arg ");
_outNode(str, node->arg);
appendStringInfo(str, " :booltesttype %d ",
(int) node->booltesttype);
}
/*
* _outNode -
* converts a Node into ascii string and append it to 'str'
@@ -1639,7 +1659,12 @@ _outNode(StringInfo str, void *obj)
case T_CaseWhen:
_outCaseWhen(str, obj);
break;
case T_NullTest:
_outNullTest(str, obj);
break;
case T_BooleanTest:
_outBooleanTest(str, obj);
break;
case T_VariableSetStmt:
break;
case T_SelectStmt: