Thread: How to execute a system file in procedure?

How to execute a system file in procedure?

From
Raymond Chui
Date:
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"`



Re: How to execute a system file in procedure?

From
"Albert REINER"
Date:
On Mon, Aug 20, 2001 at 10:08:36AM -0400, Raymond Chui wrote:
> I would like execute a system command or my program or my shell
> script in procedure. How do I do that?

use <http://www.postgresql.org/%7Epetere/plsh.html>.

Albert.