C function - other process

From: Jakub Woźny <kubaw(at)o2(dot)pl>
To: pgsql-sql(at)postgresql(dot)org
Subject: C function - other process
Date: 2005-04-22 19:18:00
Message-ID: 20050422211800.241cf201@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hello,

I wrote a simple function:

PG_FUNCTION_INFO_V1(my_fcn);

Datum
my_fcn()
{
int i,ret;
i=0;
signal(SIGCHLD,SIG_IGN);
switch(fork())
{
case 0:
{
SPI_connect();
for(i=0;i<10;i++)
{
SPI_exec("insert into my_tmp values ('asdasd');",1);
sleep(1);
}
ret = SPI_finish();
exit(ret);
}
default:
{
;
}
}
}

Next I create a function in my database:

CREATE FUNCTION my_fcn() RETURNS void
AS '$libdir/my_fcn', 'my_fcn'
LANGUAGE c;

Now I execute "select my_fcn();" and I don't see records in table
'my_tmp', but function works.
I checked returns values from SPI function, tehere are correct.
What is wrong?

Best regards,
jakub

--
kubaw(at)o2(dot)pl

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2005-04-22 19:39:55 Re: C function - other process
Previous Message Scott Marlowe 2005-04-22 14:50:14 Re: [SQL] How to install Postgres that supports 64-bit