flinfo NULL in DirectFunctionCall callee? - Mailing list pgsql-general

From Paul A Jungwirth
Subject flinfo NULL in DirectFunctionCall callee?
Date
Msg-id CA+renyUeS3vBGxur6-eZ5YCy_XKK7sFRG77DJezSMxrpeJ-9ag@mail.gmail.com
Whole thread Raw
Responses Re: flinfo NULL in DirectFunctionCall callee?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Hello,

I'm writing a multirange_cmp function which calls range_cmp to compare
individual elements. It looks like this:

cmp = DatumGetInt32(DirectFunctionCall2(
        range_cmp,
        RangeTypePGetDatum(r1),
        RangeTypePGetDatum(r2)));

But I get a segfault when range_cmp tries to reach its
fcinfo->flinfo->fn_extra, because it has a NULL flinfo, as you can see
from these debugging messages:

NOTICE:  multirange_cmp fcinfo = 0x7f875a0a66c0
NOTICE:  multirange_cmp flinfo = 0x7f875a0a6690
NOTICE:  multirange_cmp fn_extra = 0x7f875a099450
NOTICE:  range_cmp fcinfo = 0x7ffee5ff9820
NOTICE:  range_cmp flinfo = 0x0

Is it expected for flinfo to be null when using DirectFunctionCall*?
Is there something else I should use instead? It looks like
FunctionCall2 would let me pass my own flinfo, but I'm not sure how to
set that up first.

Thanks!
Paul



pgsql-general by date:

Previous
From: Luca Ferrari
Date:
Subject: Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), isCOMMIT or ROLLBACK preferred?
Next
From: Tom Lane
Date:
Subject: Re: flinfo NULL in DirectFunctionCall callee?