Re: background triggers? - Mailing list pgsql-general

From Florian G. Pflug
Subject Re: background triggers?
Date
Msg-id 44738A96.9000904@phlo.org
Whole thread Raw
In response to background triggers?  (Sim Zacks <sim@compulab.co.il>)
List pgsql-general
Sim Zacks wrote:
> Is there any way to write a statement trigger that runs in the
> background? In my testing, when I have an After Insert For Each
> Statement trigger, the function call does not end until the trigger is
> finished processing.
>
> What I would like to do, and please let me know if there is a better way
> to do this, is to have an after event statement trigger run in a
> separate process so the function call ends when it ends and the
> statement trigger gets executed on its own time.
Create some queue table, and let the after-statement trigger insert a
record into the queue.

Some daemon, or a cron-job, can then periodically check the queue, and
perform the action you want to do asynchronously.

If you don't want to use polling to find new queue entries, you can use
notify/listen to inform the daemon of new queue entries.

greetings, Florian Pflug


pgsql-general by date:

Previous
From: "Jim C. Nasby"
Date:
Subject: Re: allow LIMIT in UPDATE and DELETE
Next
From: "Jim C. Nasby"
Date:
Subject: Re: HELP!!!ERROR:operator does not exist:arc+arc