How to execute a system file in procedure? - Mailing list pgsql-sql

From Raymond Chui
Subject How to execute a system file in procedure?
Date
Msg-id 3B8119E4.A5FDCA1F@noaa.gov
Whole thread Raw
Responses Re: How to execute a system file in procedure?  ("Albert REINER" <areiner@tph.tuwien.ac.at>)
List 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@host.domain < `echo "It is time to re-index
the table"`



pgsql-sql by date:

Previous
From: Johannes Grødem
Date:
Subject: Re: Finding table constraints
Next
From: Stephan Szabo
Date:
Subject: Re: Strange DISTINCT !