On 1/27/18 22:45, Andres Freund wrote:
> I think the comment was bad, but the functionality pretty crucial. So I
> don't think
> In AtAbort_Portals(), remove the code that marks an active portal as
> failed. As the comment there already predicted, this doesn't work if
> the running command wants to keep running after transaction abort. And
> it's actually not necessary, because pquery.c is careful to run all
> portal code in a PG_TRY block and explicitly runs MarkPortalFailed() if
> there is an exception. So the code in AtAbort_Portals() is never used
> anyway.
> holds true, because FATAL errors do not follow the sigsetjmp chain.
>
> I'm uncomfortable with the idea, but without further study, it does seem
> like you might be able to largely rescue the idea by checking
> proc_exit_in_progress or similar.
Here is a patch to implement that idea. Do you have a way to test it
repeatedly, or do you just randomly cancel queries?
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services