Re: how to write/setup a C trigger function in a background worker

From: jacques klein <jacques(dot)klei(at)googlemail(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: how to write/setup a C trigger function in a background worker
Date: 2015-08-19 17:45:47
Message-ID: 1440006347.10236.28.camel@jkn0.kehl.dalim.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Well, sorry David, I don't understand what you mean,

let me explain what I want to do: in short, IPC between "background
workers".

I am trying to transform my app. from a multi-threaded C SQL-client into
some "background workers", execution speed beeing the goal (avoid
network io).
Worker start/stopping is nicely solved by server start/stop, but I have
also to do some messaging/notifying between my worker processes, and
would like to use a Postgres based solution instead of the usual unix or
network ipc, or course by avoiding polling (tables acting as message
queues).

On Wed, 2015-08-19 at 10:01 -0700, David Fetter wrote:
> On Wed, Aug 19, 2015 at 05:37:31PM +0200, jacques klein wrote:
> > I would like to execute a trigger function (written in C) in one of my
> > background workers.
> >
> > Didn't figure out how to do that not even if it's possible.
>
> You can write your trigger function in such a way as not to do the
> usual check for trigger context, but it might be better to write two
> functions, one with the trigger stuff in it, the other, which it
> calls, for whatever action you actually want to trigger, and call that
> second in your background worker.
>
> Cheers,
> David.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-08-19 18:11:31 Re: Proposal: Implement failover on libpq connect level.
Previous Message Victor Wagner 2015-08-19 17:34:48 Re: Proposal: Implement failover on libpq connect level.