mirror of
https://github.com/postgres/postgres.git
synced 2025-07-09 22:41:56 +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:
@ -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
|
||||
@ -859,6 +859,56 @@ _readCaseWhen(void)
|
||||
return local_node;
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* _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
|
||||
*
|
||||
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user