Thread: Stored Procedures for Shell Execution

Stored Procedures for Shell Execution

From
"Dustin Dortch"
Date:
Recently, I have been working on the MCSE certification, and I have been
studying SQL Server 2000 Administration for one of my electives.  Anyhow,
the reason I mention this is because of some features in SQL Server that I
think would be great in PostgreSQL.  Is there a stored procedure that allows
for the execution of shell commands?  I think it would be great.  What I
would like to accomplish is when a customer is added to my CRM application,
a script is executed on my shell.  Obviously, I woud need to create a
trigger on my user table and have it run a stored procedure, etc.

Thanks
Dustin, Network+, MCP



Re: Stored Procedures for Shell Execution

From
Martijn van Oosterhout
Date:
On Mon, Jun 17, 2002 at 01:06:53PM +0000, Dustin Dortch wrote:
> Recently, I have been working on the MCSE certification, and I have been
> studying SQL Server 2000 Administration for one of my electives.  Anyhow,
> the reason I mention this is because of some features in SQL Server that I
> think would be great in PostgreSQL.  Is there a stored procedure that allows
> for the execution of shell commands?  I think it would be great.  What I
> would like to accomplish is when a customer is added to my CRM application,
> a script is executed on my shell.  Obviously, I woud need to create a
> trigger on my user table and have it run a stored procedure, etc.

Not that I think this is a good idea (I think it's terrible, DB permissions
are not sufficient to control that sort of thing IMHO), but this is already
possible using the untrusted versions of one of the embedded scripting
languages. I think there's even a module in contrib to do it.

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

Re: Stored Procedures for Shell Execution

From
Jochem van Dieten
Date:
Dustin Dortch wrote:
> Recently, I have been working on the MCSE certification, and I have been
> studying SQL Server 2000 Administration for one of my electives.  Anyhow,
> the reason I mention this is because of some features in SQL Server that I
> think would be great in PostgreSQL.  Is there a stored procedure that allows
> for the execution of shell commands?  I think it would be great.  What I
> would like to accomplish is when a customer is added to my CRM application,
> a script is executed on my shell.  Obviously, I woud need to create a
> trigger on my user table and have it run a stored procedure, etc.

PL/sh Procedural Language Handler for PostgreSQL
http://www.ca.postgresql.org/~petere/plsh.html

Jochem


Re: Stored Procedures for Shell Execution

From
Richard Huxton
Date:
On Monday 17 Jun 2002 2:06 pm, Dustin Dortch wrote:
> Is there a stored procedure that
> allows for the execution of shell commands?  I think it would be great.
> What I would like to accomplish is when a customer is added to my CRM
> application, a script is executed on my shell.  Obviously, I woud need to
> create a trigger on my user table and have it run a stored procedure, etc.

You *could* do this, see the manuals about adding a 'C' function to
PostgreSQL. However, a better way might be to LISTEN on a connection for a
NOTIFY from your trigger. This means rather than your database running a
program with it's privileges it just states that something has happened and
your unprivileged client can then decide what to do.

- Richard Huxton