Tomas Vondra <tomas@vondra.me> writes:
> An interesting question is "What changed in PG16?" causing the query to
> fail, when it worked OK on earlier versions.
"git bisect" could be informative here. I agree with trying to
minimize the query first, though --- else you may waste time
going down blind alleys, as a result of planner changes changing
the join order without affecting the critical executor behavior.
regards, tom lane