How to execute a system file in procedure?

From: Raymond Chui <raymond(dot)chui(at)noaa(dot)gov>
To: pgsql-general(at)postgresql(dot)org(dot)pgsql-sql(at)postgresql(dot)org
Subject: How to execute a system file in procedure?
Date: 2001-08-20 14:08:36
Message-ID: 3B8119E4.A5FDCA1F@noaa.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

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(at)host(dot)domain < `echo "It is time to re-index
the table"`

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Fernando Ipar 2001-08-20 15:00:51 WAL
Previous Message Tom Lane 2001-08-20 14:00:13 Re: database corruption on VACUUM ANALYZE, now unable to initdb

Browse pgsql-sql by date

  From Date Subject
Next Message Jeff Eckermann 2001-08-20 14:29:21 Re: Simple SQL-syntax
Previous Message Fredrik Thunberg 2001-08-20 11:15:33 Simple SQL-syntax