I need to send data via http protocol (GET or POST request) from the function or trigger. Is it possible?
Asked
Active
Viewed 3.8k times
3 Answers
16
You could try writing the trigger in PL/Python and use urllib2 to POST.

Kevin
- 3,391
- 5
- 30
- 40
-
Hmm, it looks like a PL/Perl in untrusted mode (http://www.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? – im4LF Jul 24 '10 at 17:37
10
There is an extension to do this, use with caution.

Sean
- 321
- 3
- 6
-
3
-
@valijon I know this is too late; but it seems like the author of it is a postgis core contributor. So, I guess it's trusted? – saedx1 Oct 13 '22 at 12:37
4
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.

Community
- 1
- 1

Craig Ringer
- 307,061
- 76
- 688
- 778