On Fri, Aug 28, 2026 at 10:43 PM Tom Lane <[email protected]> wrote: > Sold. I'll make it so and push. Thanks for reviewing!
Fuzzing with Claude, I ran into an assertion failure that comes from
commit 2ebf25e7d:
create table t1 (a int, b int, c int);
create table t2 (a int primary key, b int, c int);
select j.x from (t1 s(x) left join t2 on s.x = t2.a) j;
server closed the connection unexpectedly
TRAP: failed Assert("context->new_index != INVALID_VAR")
This is because that since the join has an alias, j.x is a Var with
varno pointing to s and varnosyn pointing to the join. When the join
is removed, ChangeVarNodes() notices that varnosyn still references
the join's RT index, so the Assert fires.
I think this varnosyn is fine to keep. The join is only removed from
the jointree; its RTE stays in the rangetable through to the final
plan, so varnosyn still names a valid RTE. And join removal didn't
touch varnosyn before 2ebf25e7d either.
Attached is a fix.
- Richard
v1-0001-Fix-join-removal-when-Vars-reference-the-removed-.patch
Description: Binary data
