28

I need to send data via http protocol (GET or POST request) from the function or trigger. Is it possible?

3 Answers 3

16

You could try writing the trigger in PL/Python and use urllib2 to POST.

Sign up to request clarification or add additional context in comments.

1 Comment

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?
12

There is an extension to do this, use with caution.

pgsql-http

2 Comments

Is it trusted extention?
@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?
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.