Skip site navigation (1) Skip section navigation (2)

Re: Problem with DirectFunctionCall3(array_in,...)

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Jessica Ditt <jessica(dot)ditt(at)web(dot)de>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problem with DirectFunctionCall3(array_in,...)
Date: 2005-04-30 15:48:26
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Thu, Apr 28, 2005 at 02:11:29PM +0200, Jessica Ditt wrote:
> DirectFunctionCall3(array_in, CStringGetDatum(arraystring),
> ObjectIdGetDatum(20), Int32GetDatum(-1));
> unfortunately smashes my postmaster... 

Running a debugger on the core dump shows a segmentation fault at
the following line in array_in() in arrayfuncs.c:

    my_extra = (ArrayMetaState *) fcinfo->flinfo->fn_extra;

Examining the data shows that fcinfo->flinfo is NULL; presumably
dereferencing it caused the segmentation fault.  Looking at the
code for DirectFunctionCall3() in fmgr.c, we see that it initializes
fcinfo by calling InitFunctionCallInfoData() with the second argument
set to NULL, which gets assigned to flinfo.  Apparently that's the

I don't know if the following is The Right Way To Do It, but it
works for me in simple tests:

    Datum  a;

    a = OidFunctionCall3(F_ARRAY_IN,

F_ARRAY_IN is defined in utils/fmgroids.h; INT8OID is defined in

Before using the above code, you might want to see if one of the
developers follows up.  There might be a different way that's
considered best practice.

Michael Fuhr

In response to


pgsql-novice by date

Next:From: Tom LaneDate: 2005-04-30 16:52:43
Subject: Re: Problem with DirectFunctionCall3(array_in,...)
Previous:From: Michael FuhrDate: 2005-04-30 14:31:45
Subject: Re: Textarea returns

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group