aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/equalfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-05-10 22:44:49 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-05-10 22:44:49 +0000
commit2f63232d30ca64a8f2684af855230f23a701d371 (patch)
treeb7a7707d1ec9edf368780cd3f4a23755527c5884 /src/backend/nodes/equalfuncs.c
parent9a939886ac782cfee3cd5fdd1c58689163ed84be (diff)
downloadpostgresql-2f63232d30ca64a8f2684af855230f23a701d371.tar.gz
postgresql-2f63232d30ca64a8f2684af855230f23a701d371.zip
Promote row expressions to full-fledged citizens of the expression syntax,
rather than allowing them only in a few special cases as before. In particular you can now pass a ROW() construct to a function that accepts a rowtype parameter. Internal generation of RowExprs fixes a number of corner cases that used to not work very well, such as referencing the whole-row result of a JOIN or subquery. This represents a further step in the work I started a month or so back to make rowtype values into first-class citizens.
Diffstat (limited to 'src/backend/nodes/equalfuncs.c')
-rw-r--r--src/backend/nodes/equalfuncs.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index eab30d122c2..19ffbb1be70 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.219 2004/05/05 04:48:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.220 2004/05/10 22:44:44 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -424,6 +424,24 @@ _equalArrayExpr(ArrayExpr *a, ArrayExpr *b)
}
static bool
+_equalRowExpr(RowExpr *a, RowExpr *b)
+{
+ COMPARE_NODE_FIELD(args);
+ COMPARE_SCALAR_FIELD(row_typeid);
+
+ /*
+ * Special-case COERCE_DONTCARE, so that planner can build coercion
+ * nodes that are equal() to both explicit and implicit coercions.
+ */
+ if (a->row_format != b->row_format &&
+ a->row_format != COERCE_DONTCARE &&
+ b->row_format != COERCE_DONTCARE)
+ return false;
+
+ return true;
+}
+
+static bool
_equalCoalesceExpr(CoalesceExpr *a, CoalesceExpr *b)
{
COMPARE_SCALAR_FIELD(coalescetype);
@@ -1748,6 +1766,9 @@ equal(void *a, void *b)
case T_ArrayExpr:
retval = _equalArrayExpr(a, b);
break;
+ case T_RowExpr:
+ retval = _equalRowExpr(a, b);
+ break;
case T_CoalesceExpr:
retval = _equalCoalesceExpr(a, b);
break;