Re: ON INSERT => execute AWK/SH/EXE?
От | Chris Browne |
---|---|
Тема | Re: ON INSERT => execute AWK/SH/EXE? |
Дата | |
Msg-id | 60d4we2ujs.fsf@dba2.int.libertyrms.com обсуждение исходный текст |
Ответ на | ON INSERT => execute AWK/SH/EXE? ("Bima Djaloeis" <bima.djaloeis.uni@googlemail.com>) |
Список | pgsql-general |
bima.djaloeis.uni@googlemail.com ("Bima Djaloeis") writes: > Hi there, > I am new to PostgreSQL, is it possible to create something so that > 1) If I insert / update / delete an item from my DB... > 2) ... an awk / shell / external program is executed in my UNIX System? > If yes, how do I do this and if no, thanks for telling. > Thanks for reading, any help is appreciated. I Would Not try to do that directly, as that could lead to arbitrary numbers of processes getting scheduled, which could cause Plenty O Heartburn. I would instead suggest having a trigger in place that would, upon doing this: a) Insert an ID, if needed, into a work queue table. (This may be optional.) b) Use NOTIFY to tell a process that uses LISTEN to wake up and do whatever work is necessary, possibly processing *multiple* items. The LISTENING process needs to be prepared to process all the queued-up work; that should lead to *vastly* more efficient processing than spawning a worker for each item. -- "cbbrowne","@","acm.org" http://www3.sympatico.ca/cbbrowne/rdbms.html Rules of the Evil Overlord #60. "My five-year-old child advisor will also be asked to decipher any code I am thinking of using. If he breaks the code in under 30 seconds, it will not be used. Note: this also applies to passwords." <http://www.eviloverlord.com/>
В списке pgsql-general по дате отправления: