Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trigger - mail something

Status
Not open for further replies.

CoquinD

Programmer
Jul 29, 2002
2
DE
Hi,

I want to write a trigger that mails something to a address from the postgresdb.
Is that possible?

If yes - HOW?

(By the way --- kinda newbie to postgresql *g*)

Thx,
Coquind
 
This is possible because PostgreSQL allows for stored procedures (or functions) to be written in several different languages besides standard SQL:
I have read that someone implemented an email trigger in Pl/TCL. I am sure it would be even easier to implement in Pl/Perl. Basically, from Perl you can do just about anything ;-).

Note: PostgreSQL has two possible modes for procedural languages to be installed: 'trusted' and 'untrusted'. The 'trusted' mode allows any PostgreSQL user to create functions, but it severely limits the ability to interact with the OS, or to have all the functionality of that language. If you want to send mail, or do filesystem operations, for example, you should install Pl/Perl as 'untrusted'. This means that only the PostgreSQL superuser (usually postgres or pgsql) can create functions, but that these functions have access to all of Perl's functionality. Just remember-- there are security implications with this method, so be sure you have read all the documentation clearly before you take this step. -------------------------------------------

"Now, this might cause some discomfort..."
(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top