X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 4A68B52818 for ; Tue, 17 May 2005 15:01:29 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61363-06 for ; Tue, 17 May 2005 18:01:18 +0000 (GMT) Received: from mail.ualr.edu (mcfeely.ualr.edu [144.167.10.21]) by svr1.postgresql.org (Postfix) with ESMTP id B4C8752803 for ; Tue, 17 May 2005 15:01:17 -0300 (ADT) Received: from mfilter1.ualr.edu (midsouth.ualr.edu [144.167.10.248]) by mail.ualr.edu (Sun Java System Messaging Server 6.1 HotFix 0.09 (built Dec 14 2004)) with ESMTP id <0IGN00LD0BE6YPH0@mail.ualr.edu> for pgsql-sql@postgresql.org; Tue, 17 May 2005 13:01:18 -0500 (CDT) Received: from [144.167.1.30] (helo=[144.167.1.30]) by mfilter1.ualr.edu with esmtp (Exim 4.34) id 1DY6My-0001bj-5O for pgsql-sql@postgresql.org; Tue, 17 May 2005 13:00:40 -0500 Date: Tue, 17 May 2005 13:01:18 -0500 From: Jay Parker Subject: triggering an external action To: pgsql-sql@postgresql.org Message-id: <428A316E.7090401@ualr.edu> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7BIT X-Accept-Language: en-us, en X-No-Spam-Signature: fc43e723684f45ea09ffcc1265c21e30 User-Agent: Mozilla Thunderbird 1.0 (X11/20041206) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200505/132 X-Sequence-Number: 21445 I am trying to find the best way for a database trigger to signal a client process to take an action. Specifically, I am working on the classic problem of creating and modifying system accounts based on the updates to a "person registry" database. The basic model I'm working with has triggers on my tables of interest that stick a person's unique ID into a "todo queue" table whenever modifications are made. The queue is periodically polled by a script which processes and deletes each "todo" record. The polling script goes to sleep for gradually increasing periods of time whenever it polls the queue and finds it empty. What I want is a trigger on the "todo" table that will "kick" my processing script to make it wake up and process the queue immediately. In an Oracle environment, I think I could use a database pipe to achieve more or less the behavior I'm looking for, but I can't find anything that does what I want in pgsql at the database level. I could write a trigger in C or Perl or something that would do something at the OS level, like send a signal, but when I go down that path I start having to deal with unix issues like having to elevate to root privs to send a signal to a process that isn't running as the pgsql user, etc. It is doable but gets complex quickly. Is there anything I'm missing at the database level that would help me process updates in realtime? (And if not, which of the other mailing lists would be the most appropriate place for me to discuss the best way to implement an OS-level solution?) Thanks, -jbp -- Jay Parker - UALR Computing Services - Networks Project Manager jbparker@ualr.edu - http://www.ualr.edu/jbparker - 501-569-3345 But I have promises to keep, And miles to go before I sleep. -Frost