Hello
Thank you for report. This bug should be already fixed in stable branch and will be shipped in next minor release.
Untilthe fix is released, the simplest workaround is to disable parallel query with SET max_parallel_workers_per_gather
=0 if you're affected by the bug.
It's a rare timing bug, but some workloads seem to be more prone to it, so unfortunately it went undetected for a long
time.
If you're interested, related discussion was here:
https://www.postgresql.org/message-id/flat/CAMAYy4%2Bw3NTBM5JLWFi8twhWK4%3Dk_5L4nV5%2BbYDSPu8r4b97Zg%40mail.gmail.com
regards, Sergei