* Call a previously-looked-up datatype binary-input function. * * "buf" may be NULL to indicate we are reading a NULL. In this case * the caller should assume the result is NULL, but we'll call the receive * function anyway if it's not strict. So this is almost but not quite * the same as FunctionCall3. */
| 1586 | * the same as FunctionCall3. |
| 1587 | */ |
| 1588 | Datum |
| 1589 | ReceiveFunctionCall(FmgrInfo *flinfo, StringInfo buf, |
| 1590 | Oid typioparam, int32 typmod) |
| 1591 | { |
| 1592 | LOCAL_FCINFO(fcinfo, 3); |
| 1593 | Datum result; |
| 1594 | |
| 1595 | if (buf == NULL && flinfo->fn_strict) |
| 1596 | return (Datum) 0; /* just return null result */ |
| 1597 | |
| 1598 | InitFunctionCallInfoData(*fcinfo, flinfo, 3, InvalidOid, NULL, NULL); |
| 1599 | |
| 1600 | fcinfo->args[0].value = PointerGetDatum(buf); |
| 1601 | fcinfo->args[0].isnull = false; |
| 1602 | fcinfo->args[1].value = ObjectIdGetDatum(typioparam); |
| 1603 | fcinfo->args[1].isnull = false; |
| 1604 | fcinfo->args[2].value = Int32GetDatum(typmod); |
| 1605 | fcinfo->args[2].isnull = false; |
| 1606 | |
| 1607 | result = FunctionCallInvoke(fcinfo); |
| 1608 | |
| 1609 | /* Should get null result if and only if buf is NULL */ |
| 1610 | if (buf == NULL) |
| 1611 | { |
| 1612 | if (!fcinfo->isnull) |
| 1613 | elog(ERROR, "receive function %u returned non-NULL", |
| 1614 | flinfo->fn_oid); |
| 1615 | } |
| 1616 | else |
| 1617 | { |
| 1618 | if (fcinfo->isnull) |
| 1619 | elog(ERROR, "receive function %u returned NULL", |
| 1620 | flinfo->fn_oid); |
| 1621 | } |
| 1622 | |
| 1623 | return result; |
| 1624 | } |
| 1625 | |
| 1626 | /* |
| 1627 | * Call a previously-looked-up datatype binary-output function. |
no test coverage detected