I'm trying to run a function from within another function using dblink, this is so I can create an autonomous transaction. My understanding is that PostgreSQL doesn't support autonomous transactions and this is the suggested workaround for this.
I can't seem to work this out and fire a function that returns a void
I'm very new to dblink so probably doing something very stupid! And if I've missed a trick do let me know!
my dblink code that sit within the function is as follows
quick explanation of why I want to do this in case someone can think of a better method!
Basically, if my function fails I want everything to roll back - which it does - fabulous.
I also want my function to send an email to the user detailing the issue. In order to do that I call another function which writes a row to an email queue table which gets processed and the email sent. Problem is that this row gets rolled back with the main transaction.