pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jakub Woźny <kubaw@o2.pl>
To: pgsql-sql@postgresql.org
Subject: C function - other process
Date: Fri, 22 Apr 2005 21:18:00 +0200
Message-ID: <20050422211800.241cf201@localhost> (raw)

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@o2.pl



view thread (5+ messages)  latest in thread

Message-ID: <20050422211800.241cf201@localhost>
Permalink:  ../20050422211800.241cf201@localhost/
Also on:    postgresql.org/message-id/20050422211800.241cf201@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: kubaw@o2.pl
  Subject: Re: C function - other process
  In-Reply-To: <20050422211800.241cf201@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox