mirror of
https://github.com/postgres/postgres.git
synced 2025-08-24 09:27:52 +03:00
Implement the IS DISTINCT FROM operator per SQL99.
Reused the Expr node to hold DISTINCT which strongly resembles the existing OP info. Define DISTINCT_EXPR which strongly resembles the existing OPER_EXPR opType, but with handling for NULLs required by SQL99. We have explicit support for single-element DISTINCT comparisons all the way through to the executor. But, multi-element DISTINCTs are handled by expanding into a comparison tree in gram.y as is done for other row comparisons. Per discussions, it might be desirable to move this into one or more purpose-built nodes to be handled in the backend. Define the optional ROW keyword and token per SQL99. This allows single-element row constructs, which were formerly disallowed due to shift/reduce conflicts with parenthesized a_expr clauses. Define the SQL99 TREAT() function. Currently, use as a synonym for CAST().
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.160 2002/06/20 20:29:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/outfuncs.c,v 1.161 2002/07/04 15:23:53 thomas Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Every (plan) node in POSTGRES has an associated "out" routine which
|
||||
@@ -719,6 +719,9 @@ _outExpr(StringInfo str, Expr *node)
|
||||
case OP_EXPR:
|
||||
opstr = "op";
|
||||
break;
|
||||
case DISTINCT_EXPR:
|
||||
opstr = "distinct";
|
||||
break;
|
||||
case FUNC_EXPR:
|
||||
opstr = "func";
|
||||
break;
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.123 2002/06/20 20:29:29 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.124 2002/07/04 15:23:54 thomas Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Most of the read functions for plan nodes are tested. (In fact, they
|
||||
@@ -804,6 +804,8 @@ _readExpr(void)
|
||||
token = pg_strtok(&length); /* get opType */
|
||||
if (strncmp(token, "op", 2) == 0)
|
||||
local_node->opType = OP_EXPR;
|
||||
else if (strncmp(token, "distinct", 8) == 0)
|
||||
local_node->opType = DISTINCT_EXPR;
|
||||
else if (strncmp(token, "func", 4) == 0)
|
||||
local_node->opType = FUNC_EXPR;
|
||||
else if (strncmp(token, "or", 2) == 0)
|
||||
|
Reference in New Issue
Block a user