I need to send data via http protocol (GET or POST request) from the function or trigger. Is it possible?
3 Answers
You could try writing the trigger in PL/Python and use urllib2 to POST.
1 Comment
im4LF
Hmm, it looks like a PL/Perl in untrusted mode (postgresql.org/docs/8.4/interactive/plperl-trusted.html)... Are there differences in the use of PL/Python and PL/Perl? Both of then must be runned in untrusted mode and thats all? This means that I can use the module IO::Socket or HTTP::Request without any limitations?
There is an extension to do this, use with caution.
Any "untrusted" language with HTTP support can do this:
- PL/Pythonu
- PL/perlu
- PL/javau
- ...
but you shouldn't really do it. See Does PLV8 support making http calls to other servers? and why you shouldn't send email from a trigger function.