Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-general by date

Next:From: Chris BrowneDate: 2008-10-27 20:26:27
Subject: Re: Execute Shell script after insert
Previous:From: Tom LaneDate: 2008-10-27 20:16:16
Subject: Re: Execute Shell script after insert

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group