aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/readfuncs.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/readfuncs.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/readfuncs.c')
-rw-r--r--src/backend/nodes/readfuncs.c56
1 files changed, 55 insertions, 1 deletions
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index a83f0b64dbf..2f0dec048b3 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.110 2001/06/05 05:26:04 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.111 2001/06/19 22:39:11 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -860,6 +860,56 @@ _readCaseWhen(void)
}
/* ----------------
+ * _readNullTest
+ *
+ * NullTest is a subclass of Node
+ * ----------------
+ */
+static NullTest *
+_readNullTest(void)
+{
+ NullTest *local_node;
+ char *token;
+ int length;
+
+ local_node = makeNode(NullTest);
+
+ token = pg_strtok(&length); /* eat :arg */
+ local_node->arg = nodeRead(true); /* now read it */
+
+ token = pg_strtok(&length); /* eat :nulltesttype */
+ token = pg_strtok(&length); /* get nulltesttype */
+ local_node->nulltesttype = (NullTestType) atoi(token);
+
+ return local_node;
+}
+
+/* ----------------
+ * _readBooleanTest
+ *
+ * BooleanTest is a subclass of Node
+ * ----------------
+ */
+static BooleanTest *
+_readBooleanTest(void)
+{
+ BooleanTest *local_node;
+ char *token;
+ int length;
+
+ local_node = makeNode(BooleanTest);
+
+ token = pg_strtok(&length); /* eat :arg */
+ local_node->arg = nodeRead(true); /* now read it */
+
+ token = pg_strtok(&length); /* eat :booltesttype */
+ token = pg_strtok(&length); /* get booltesttype */
+ local_node->booltesttype = (BoolTestType) atoi(token);
+
+ return local_node;
+}
+
+/* ----------------
* _readVar
*
* Var is a subclass of Expr
@@ -1966,6 +2016,10 @@ parsePlanString(void)
return_value = _readCaseExpr();
else if (length == 4 && strncmp(token, "WHEN", length) == 0)
return_value = _readCaseWhen();
+ else if (length == 8 && strncmp(token, "NULLTEST", length) == 0)
+ return_value = _readNullTest();
+ else if (length == 11 && strncmp(token, "BOOLEANTEST", length) == 0)
+ return_value = _readBooleanTest();
else
elog(ERROR, "badly formatted planstring \"%.10s\"...", token);