Calling 'c' function from PostGreSQL

From: "Atul" <atulk(at)newgen(dot)co(dot)in>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Calling 'c' function from PostGreSQL
Date: 2001-04-09 10:47:08
Message-ID: 001201c0c0e2$6cb53250$5e05a8c0@atul
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Is it possible to call a language 'C' function from a PL/pgSQL function. I have the following code:

// file myfunc.c
#include "postgres.h"

text* myfunc();

text* myfunc()
{
text* ch;
*ch = '1,2';
return ch;
}

// C file ends here

create function myfunc as
'myfunc.so' langauge 'c';

create function test() returns text as '
declare
at text;
begin
at := myfunc();
return at;
end;
' language 'plpgsql';

The above when executed gives pqReadData()-- backend closed the channel unexpectedly.

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2001-04-09 11:21:20 Re: Calling 'c' function from PostGreSQL
Previous Message Brett W. McCoy 2001-04-09 00:58:05 Re: copy from multi-line text problem