pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Raymond Chui <raymond.chui@noaa.gov>
To: pgsql-general@postgresql.org.pgsql-sql
Subject: How to execute a system file in procedure?
Date: Mon, 20 Aug 2001 10:08:36 -0400
Message-ID: <3B8119E4.A5FDCA1F@noaa.gov> (raw)

I would like execute a system command or my program or my shell
script in procedure. How do I do that?
For example,

CREATE FUNCTION myname() RETURN OPAQUE AS '
    BEGIN
        IF count(NEW.aColumn) >= 600
        THEN RAISE EXCEPTION ''Hello, it is time to re-index the
table.'';
        END IF;
        RETURN NEW;
    END; '
LANGUAGE 'plpgsql';

CREATE TRIGGER AFTER INSERT OR UPDATE ON mytable
FOR EACH ROW EXECUTE PROCEDURE myname();

But I prefer to execute a system command like mail

mail -s "Re-Index" system@host.domain < `echo "It is time to re-index
the table"`





view thread (2+ messages)  latest in thread

Message-ID: <3B8119E4.A5FDCA1F@noaa.gov>
Permalink:  ../3B8119E4.A5FDCA1F@noaa.gov/
Also on:    postgresql.org/message-id/3B8119E4.A5FDCA1F@noaa.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: raymond.chui@noaa.gov, pgsql-general@postgresql.org.pgsql-sql
  Subject: Re: How to execute a system file in procedure?
  In-Reply-To: <3B8119E4.A5FDCA1F@noaa.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox