Asim R P <apraveen@pivotal.io> writes:
> Cancel/terminate requests are held off during "PREPARE TRANSACTION"
> processing in function PrepareTransaction(). However, a subroutine invoked
> by PrepareTransaction() may perform elog(ERROR) or elog(FATAL).
Doing anything that's likely to fail in the post-commit code path is
a Bad Idea (TM). There's no good recovery avenue, so the fact that
you generally end up at a PANIC is expected/intentional.
The correct response, if you notice code doing that, is to fix it so
it doesn't do that. Typically the right answer is to move the
failure-prone operation to pre-commit processing.
regards, tom lane