Basically doing the following causes both of the queries to run at the same time, and hence causing the synchronous transaction to fail due to the async query's transaction being open.
local asyncQ = pg:query("do something that takes a while");
asyncQ:run()
local syncQ = pg:query("SELECT 1");
syncQ:set_sync(true)
local b, reason = syncQ:run()
assert(b == false)
-- reason = Started transaction<READ COMMITTED> while transaction<READ COMMITTED> still active
This is quite a corner case, and will be solved for me as well when I'm able to safely migrate all queries to use asynchronous mode, but thought I'd report it anyway.