Attached is the v2 version that fixes a test failure due to plan change (bitmap index scan -> index only scan).