Re: Execute Shell script after insert

From: David Fetter <david(at)fetter(dot)org>
To: Anderson dos Santos Donda <andersondonda(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Execute Shell script after insert
Date: 2008-10-27 20:19:34
Message-ID: 20081027201934.GI15649@fetter.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Oct 27, 2008 at 03:09:31PM -0300, Anderson dos Santos Donda wrote:
> Is there a way to execute a simple shell script in server after execute
> INSERT INTO ?
>
> Example?
>
> INSERT INTO clients (name) VALUES ('Donda');
>
> after it, execute shell : mkdir $1

This will scale better if you batch it, as in:

INSERT INTO clients (name, status)
VALUES
('Donda', 'inserted_no_directory'),
('Eonda', 'inserted_no_directory'),
('Fonda', 'inserted_no_directory'),
...

Once you're done loading, sweep through the ones so marked.

Cheers,
David.
--
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778 AIM: dfetter666 Yahoo!: dfetter
Skype: davidfetter XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2008-10-27 20:26:27 Re: Execute Shell script after insert
Previous Message Tom Lane 2008-10-27 20:16:16 Re: Execute Shell script after insert