flinfo NULL in DirectFunctionCall callee?

From: Paul A Jungwirth <pj(at)illuminatedcomputing(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: flinfo NULL in DirectFunctionCall callee?
Date: 2019-08-26 14:51:27
Message-ID: CA+renyUeS3vBGxur6-eZ5YCy_XKK7sFRG77DJezSMxrpeJ-9ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-08-26 15:11:58 Re: flinfo NULL in DirectFunctionCall callee?
Previous Message Luca Ferrari 2019-08-26 10:23:44 Re: For SELECT statement (just a reading one, no 'FOR UPDATE'), is COMMIT or ROLLBACK preferred?