aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/equalfuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes/equalfuncs.c')
-rw-r--r--src/backend/nodes/equalfuncs.c81
1 files changed, 11 insertions, 70 deletions
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 2171d8d018b..40fd80fd9cd 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -83,6 +83,10 @@
#define COMPARE_LOCATION_FIELD(fldname) \
((void) 0)
+/* Compare a CoercionForm field (also a no-op, per comment in primnodes.h) */
+#define COMPARE_COERCIONFORM_FIELD(fldname) \
+ ((void) 0)
+
/*
* Stuff from primnodes.h
@@ -235,16 +239,7 @@ _equalFuncExpr(const FuncExpr *a, const FuncExpr *b)
COMPARE_SCALAR_FIELD(funcid);
COMPARE_SCALAR_FIELD(funcresulttype);
COMPARE_SCALAR_FIELD(funcretset);
-
- /*
- * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
- * that are equal() to both explicit and implicit coercions.
- */
- if (a->funcformat != b->funcformat &&
- a->funcformat != COERCE_DONTCARE &&
- b->funcformat != COERCE_DONTCARE)
- return false;
-
+ COMPARE_COERCIONFORM_FIELD(funcformat);
COMPARE_SCALAR_FIELD(funccollid);
COMPARE_SCALAR_FIELD(inputcollid);
COMPARE_NODE_FIELD(args);
@@ -448,16 +443,7 @@ _equalRelabelType(const RelabelType *a, const RelabelType *b)
COMPARE_SCALAR_FIELD(resulttype);
COMPARE_SCALAR_FIELD(resulttypmod);
COMPARE_SCALAR_FIELD(resultcollid);
-
- /*
- * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
- * that are equal() to both explicit and implicit coercions.
- */
- if (a->relabelformat != b->relabelformat &&
- a->relabelformat != COERCE_DONTCARE &&
- b->relabelformat != COERCE_DONTCARE)
- return false;
-
+ COMPARE_COERCIONFORM_FIELD(relabelformat);
COMPARE_LOCATION_FIELD(location);
return true;
@@ -469,16 +455,7 @@ _equalCoerceViaIO(const CoerceViaIO *a, const CoerceViaIO *b)
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(resulttype);
COMPARE_SCALAR_FIELD(resultcollid);
-
- /*
- * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
- * that are equal() to both explicit and implicit coercions.
- */
- if (a->coerceformat != b->coerceformat &&
- a->coerceformat != COERCE_DONTCARE &&
- b->coerceformat != COERCE_DONTCARE)
- return false;
-
+ COMPARE_COERCIONFORM_FIELD(coerceformat);
COMPARE_LOCATION_FIELD(location);
return true;
@@ -493,16 +470,7 @@ _equalArrayCoerceExpr(const ArrayCoerceExpr *a, const ArrayCoerceExpr *b)
COMPARE_SCALAR_FIELD(resulttypmod);
COMPARE_SCALAR_FIELD(resultcollid);
COMPARE_SCALAR_FIELD(isExplicit);
-
- /*
- * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
- * that are equal() to both explicit and implicit coercions.
- */
- if (a->coerceformat != b->coerceformat &&
- a->coerceformat != COERCE_DONTCARE &&
- b->coerceformat != COERCE_DONTCARE)
- return false;
-
+ COMPARE_COERCIONFORM_FIELD(coerceformat);
COMPARE_LOCATION_FIELD(location);
return true;
@@ -513,16 +481,7 @@ _equalConvertRowtypeExpr(const ConvertRowtypeExpr *a, const ConvertRowtypeExpr *
{
COMPARE_NODE_FIELD(arg);
COMPARE_SCALAR_FIELD(resulttype);
-
- /*
- * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
- * that are equal() to both explicit and implicit coercions.
- */
- if (a->convertformat != b->convertformat &&
- a->convertformat != COERCE_DONTCARE &&
- b->convertformat != COERCE_DONTCARE)
- return false;
-
+ COMPARE_COERCIONFORM_FIELD(convertformat);
COMPARE_LOCATION_FIELD(location);
return true;
@@ -589,16 +548,7 @@ _equalRowExpr(const RowExpr *a, const 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;
-
+ COMPARE_COERCIONFORM_FIELD(row_format);
COMPARE_NODE_FIELD(colnames);
COMPARE_LOCATION_FIELD(location);
@@ -684,16 +634,7 @@ _equalCoerceToDomain(const CoerceToDomain *a, const CoerceToDomain *b)
COMPARE_SCALAR_FIELD(resulttype);
COMPARE_SCALAR_FIELD(resulttypmod);
COMPARE_SCALAR_FIELD(resultcollid);
-
- /*
- * Special-case COERCE_DONTCARE, so that planner can build coercion nodes
- * that are equal() to both explicit and implicit coercions.
- */
- if (a->coercionformat != b->coercionformat &&
- a->coercionformat != COERCE_DONTCARE &&
- b->coercionformat != COERCE_DONTCARE)
- return false;
-
+ COMPARE_COERCIONFORM_FIELD(coercionformat);
COMPARE_LOCATION_FIELD(location);
return true;