aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/network.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/adt/network.c')
-rw-r--r--src/backend/utils/adt/network.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/backend/utils/adt/network.c b/src/backend/utils/adt/network.c
index aac76217173..350b1a63d21 100644
--- a/src/backend/utils/adt/network.c
+++ b/src/backend/utils/adt/network.c
@@ -902,9 +902,12 @@ inet_merge(PG_FUNCTION_ARGS)
* Convert a value of a network datatype to an approximate scalar value.
* This is used for estimating selectivities of inequality operators
* involving network types.
+ *
+ * On failure (e.g., unsupported typid), set *failure to true;
+ * otherwise, that variable is not changed.
*/
double
-convert_network_to_scalar(Datum value, Oid typid)
+convert_network_to_scalar(Datum value, Oid typid, bool *failure)
{
switch (typid)
{
@@ -931,8 +934,6 @@ convert_network_to_scalar(Datum value, Oid typid)
res += ip_addr(ip)[i];
}
return res;
-
- break;
}
case MACADDROID:
{
@@ -956,11 +957,7 @@ convert_network_to_scalar(Datum value, Oid typid)
}
}
- /*
- * Can't get here unless someone tries to use scalarineqsel() on an
- * operator with one network and one non-network operand.
- */
- elog(ERROR, "unsupported type: %u", typid);
+ *failure = true;
return 0;
}