}
/*
- * Apply the operator to the element pair
+ * Apply the operator to the element pair; treat NULL as false
*/
locfcinfo->args[0].value = elt1;
locfcinfo->args[0].isnull = false;
locfcinfo->args[1].isnull = false;
locfcinfo->isnull = false;
oprresult = DatumGetBool(FunctionCallInvoke(locfcinfo));
- if (!oprresult)
+ if (locfcinfo->isnull || !oprresult)
{
result = false;
break;
locfcinfo->args[0].isnull = false;
locfcinfo->args[1].value = elt2;
locfcinfo->args[1].isnull = false;
- locfcinfo->isnull = false;
cmpresult = DatumGetInt32(FunctionCallInvoke(locfcinfo));
+ /* We don't expect comparison support functions to return null */
+ Assert(!locfcinfo->isnull);
+
if (cmpresult == 0)
continue; /* equal */
/* Apply the hash function */
locfcinfo->args[0].value = elt;
locfcinfo->args[0].isnull = false;
- locfcinfo->isnull = false;
elthash = DatumGetUInt32(FunctionCallInvoke(locfcinfo));
+ /* We don't expect hash functions to return null */
+ Assert(!locfcinfo->isnull);
}
/*
locfcinfo->args[1].value = Int64GetDatum(seed);
locfcinfo->args[1].isnull = false;
elthash = DatumGetUInt64(FunctionCallInvoke(locfcinfo));
+ /* We don't expect hash functions to return null */
+ Assert(!locfcinfo->isnull);
}
result = (result << 5) - result + elthash;
continue; /* can't match */
/*
- * Apply the operator to the element pair
+ * Apply the operator to the element pair; treat NULL as false
*/
locfcinfo->args[0].value = elt1;
locfcinfo->args[0].isnull = false;
locfcinfo->args[1].isnull = false;
locfcinfo->isnull = false;
oprresult = DatumGetBool(FunctionCallInvoke(locfcinfo));
- if (oprresult)
+ if (!locfcinfo->isnull && oprresult)
break;
}
else
{
/*
- * Apply the operator to the element pair
+ * Apply the operator to the element pair; treat NULL as false
*/
locfcinfo->args[0].value = elt;
locfcinfo->args[0].isnull = false;
locfcinfo->args[1].isnull = false;
locfcinfo->isnull = false;
oprresult = DatumGetBool(FunctionCallInvoke(locfcinfo));
- if (!oprresult)
+ if (locfcinfo->isnull || !oprresult)
{
/* no match, keep element */
values[nresult] = elt;
locfcinfo->args[0].isnull = false;
locfcinfo->args[1].value = fetch_att(ptr, typbyval, typlen);
locfcinfo->args[1].isnull = false;
- locfcinfo->isnull = false;
cmpresult = DatumGetInt32(FunctionCallInvoke(locfcinfo));
+ /* We don't expect comparison support functions to return null */
+ Assert(!locfcinfo->isnull);
+
if (cmpresult < 0)
right = mid;
else
cmpresult = DatumGetInt32(FunctionCallInvoke(locfcinfo));
+ /* We don't expect comparison support functions to return null */
+ Assert(!locfcinfo->isnull);
+
if (cmpresult < 0)
right = mid;
else
locfcinfo->args[0].isnull = false;
locfcinfo->args[1].value = values2[i2];
locfcinfo->args[1].isnull = false;
- locfcinfo->isnull = false;
cmpresult = DatumGetInt32(FunctionCallInvoke(locfcinfo));
+ /* We don't expect comparison support functions to return null */
+ Assert(!locfcinfo->isnull);
+
if (cmpresult < 0)
{
/* arg1 is less than arg2 */
locfcinfo->args[0].isnull = false;
locfcinfo->args[1].value = values2[i2];
locfcinfo->args[1].isnull = false;
- locfcinfo->isnull = false;
oprresult = DatumGetBool(FunctionCallInvoke(locfcinfo));
- if (!oprresult)
+ if (locfcinfo->isnull || !oprresult)
{
result = false;
break;