Received: from sss.pgh.pa.us (sss.pgh.pa.us [209.114.132.154]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f2THDaK55497 for ; Thu, 29 Mar 2001 12:13:36 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.3/8.11.3) with ESMTP id f2THDIw22853; Thu, 29 Mar 2001 12:13:18 -0500 (EST) To: Peter Eisentraut cc: A James Lewis , Peter Mount , Mathijs Brands , pgsql-sql@postgresql.org Subject: Re: Calling Java from psql (was Re: requesting help) In-reply-to: References: Comments: In-reply-to Peter Eisentraut message dated "Thu, 29 Mar 2001 18:59:00 +0200" Date: Thu, 29 Mar 2001 12:13:18 -0500 Message-ID: <22850.985885998@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200103/614 X-Sequence-Number: 2285 Peter Eisentraut writes: > A James Lewis writes: >> Before I go investigating this, is it possible to trigger an arbitrary >> program from the SQL, say a shell script? > At the lowest level, you can generally do anything a C program can do. > Writing the equivalent of system() in SQL should be rather trivial. I'm generally pretty suspicious of any system design that requires calling outside programs from an SQL function. The problem is that this fundamentally breaks transactional semantics: if the transaction is rolled back after the function call, its effects inside the database disappear ... but there's no way to roll back whatever the outside program did. Now you have a consistency problem. I'd suggest thinking hard about how to restructure your system design so that you do not need this capability. Yes, it'd be easy to implement, but that doesn't make it a good idea. regards, tom lane