Attached is a fix that works for me. Nevertheless, REPACK (CONCURRENTLY) in your test goes ahead only due to commit 0d3dba38c7, which will probably be reverted [1]. Then REPACK will wait for the transaction in the other database (db1) to complete before it can actually start.