C vs plpgsql and child processes

Поиск
Список
Период
Сортировка
От Jason Godden
Тема C vs plpgsql and child processes
Дата
Msg-id 200308172328.33207.jasongodden@optushome.com.au
обсуждение исходный текст
Ответы Re: C vs plpgsql and child processes  (Sean Chittenden <sean@chittenden.org>)
Список pgsql-general
Hi All,

I've written a few C functions in the version 1 format as well as some SPI
based backend bits and I'm curious as to how PG treats these items when used
within plpgsql.

The set of functions control external processes.  One function is called with
various items governed by the db, does a fork and then execl to from the
child to start a new process.  Whilst it's not posix i ignore the SIGCHLD
signal and let the parent process return the pid to postgres.  This seems to
all be good and postgres itself obviously doesn't wait for the child to
finish (which is intentional).  When the child finishes it terminates
correctly and doesn't zombie out.

Problem is that when I call these particular functions from within plpgsql
rather than through a single sql command the child never actually starts (or
starts and then exits immediately).  I presume it's more to do with the fact
that what I'm doing is a bit of a hack in some senses and isn't really the
best way to go about it.  Is there any specific reason why this idea wouldn't
work within plpgsql?  Or should I look at moving the whole function to C?  I
can certainly appreciate why it wouldn't work - just some info as to the best
way to achieve this concept would be great.

Rgds,

Jason

В списке pgsql-general по дате отправления:

Предыдущее
От: stephane parenton
Дата:
Сообщение: Re: insert and heritage... ooops... solved
Следующее
От: "Nikola Milutinovic"
Дата:
Сообщение: Re: Dreamweaver