Re: calling a shell script from pl/pgsql - Mailing list pgsql-sql

From Jan Wieck
Subject Re: calling a shell script from pl/pgsql
Date
Msg-id 200109110708.f8B78VV01263@saturn.jw.home
Whole thread Raw
In response to Re: calling a shell script from pl/pgsql  ("Jeff Barrett" <jbarrett@familynetwork.com>)
List pgsql-sql
Jeff Barrett wrote:
> Thanks for the suggestions.
>
> I am running 7.1.2 and going to 7.1.3 soon.
>
> If I use pl/tclu or pl/perlu I can call this executable from within the
> code?
>
> I have a signifigant limitation, I cannot duplicate the action of the
> programs I want to call in a program I write within postgres, I need to call
> the executable (In this one case it is a shell script but I have others
> where it is a binary).
   That's  kind of a fuzzy explanation. If this "action" of your   programs in any way affects data, that should be
partof  the   triggers  transaction,  then what you want to do is broken by   design.
 
   In detail, if the external program you're  calling  from  the   trigger  connects to the database, updates it and
terminates,  the transaction that fired the trigger  can  still  rollback,   discarding  all changes that caused the
triggerto get fired.   Thus, the database should look like  the  trigger  never  got   fired  -  but  how  do  you undo
thechanges of your external   program? It connected to  the  database,  did  it's  updates,   committed and terminated.
You'llhave no chance to undo that.
 
   So if you really intend to do what  it  smells  like,  you're   better off moving all the "external program"s logic
intosome   function inside  of  the  database,  and  call  it  from  the   external program as well as the trigger.
 


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



pgsql-sql by date:

Previous
From: "Josh Berkus"
Date:
Subject: Re: group by weirdness
Next
From: Kevin Way
Date:
Subject: table inheritance and foreign key troubles