Re: calling a C function from pgsql function - Mailing list pgsql-general

From Craig Ringer
Subject Re: calling a C function from pgsql function
Date
Msg-id 503E1AAB.8060504@ringerc.id.au
Whole thread Raw
In response to calling a C function from pgsql function  (tamanna madaan <tamanna.madaan@globallogic.com>)
List pgsql-general
On 08/29/2012 09:18 PM, tamanna madaan wrote:

> 1. what are the ways to get  the value returned by this library function .

You need to wrap the C library function with a PostgreSQL C extension
that uses the fmgr.h APIs, so it's callable from SQL and can return a
result to SQL. See:

     http://www.postgresql.org/docs/current/static/xfunc-c.html

> 2. when test1 is called, will it wait for "test1" to return before
> continuing with the next statement in "test" or it will continue with
> the next statement parallely while "test1" is being executed.

The call will return when the C wrapper function returns, so they'll be
executed in series not in parallel.

> 3. Moreover, will test1  be called sequentially in order for all the
> three arguments i.e arg1 first and arg3 in last. Or there can be a
> different order.

The calls will be executed in the order they appear in the PL/PgSQL
function.

--
Craig Ringer


pgsql-general by date:

Previous
From: Chris Angelico
Date:
Subject: Re: PQfformat question and retrieving bytea data in C
Next
From: Pavel Stehule
Date:
Subject: Re: calling a C function from pgsql function