On Fri, Aug 24, 2018 at 6:53 AM, Tom Lane <t...@sss.pgh.pa.us> wrote: > Thomas Munro <thomas.mu...@enterprisedb.com> writes: >> On Wed, Jul 25, 2018 at 7:27 PM, Daniel Gustafsson <dan...@yesql.se> wrote: >>> Seems the build of the updated patch built and tested Ok. Still have no >>> idea >>> why the previous one didn’t. > >> That problem apparently didn't go away. cfbot tested it 7 times in >> the past week, and it passed only once on Windows: >> https://ci.appveyor.com/project/postgresql-cfbot/postgresql/build/1.0.9691 >> The other times all failed like this: >> https://ci.appveyor.com/project/postgresql-cfbot/postgresql/build/1.0.9833 > > I think this is just a timing problem: the signal gets sent, > but it might or might not get received before the current statement ends. > It's possible that a signal-sent-to-self can be expected to be received > synchronously on all Unix platforms, but I wouldn't entirely bet on that > (in particular, the POSIX text for kill(2) does NOT guarantee it); and > our Windows signal implementation certainly doesn't guarantee anything > of the sort.
How about we just wait forever if the function manages to return? select case when pg_cancel_backend(pg_backend_pid(), '...') then pg_sleep('infinity') end; -- Thomas Munro http://www.enterprisedb.com