aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/outfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-06-19 22:39:12 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-06-19 22:39:12 +0000
commit116d2bba7eeaf25c544bc187e3ad2a8677a9a22c (patch)
treec77a6b20a3acdbb6e25a1fc4a561c0e839ddbb1e /src/backend/nodes/outfuncs.c
parent8c30aca2ba1a48d38b1206f8559d1dc6b65c5ca7 (diff)
downloadpostgresql-116d2bba7eeaf25c544bc187e3ad2a8677a9a22c.tar.gz
postgresql-116d2bba7eeaf25c544bc187e3ad2a8677a9a22c.zip
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.
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r--src/backend/nodes/outfuncs.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index ebcacd49750..e555e9591ec 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -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, " ");
@@ -1403,6 +1397,32 @@ _outCaseWhen(StringInfo str, CaseWhen *node)
}
/*
+ * 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: