cockroach
cockroach copied to clipboard
opt: project required ordering for EXPLAIN to input columns
Previously, EXPLAIN operators could require an ordering on non-output columns from their enclosed expression, which causes a panic. This could happen after column-pruning rules fired. This commit modifies the order-building logic to project the ordering required of the child of an EXPLAIN operator to only reference output columns.
Fixes #88037
Release note (bug fix): Fixed a longstanding bug that could cause a panic when running a query with EXPLAIN that attempts to order on a non-output column.
Let's merge this to fix the sqlsmith failures.
bors r=mgartner,yuzefovich
@DrewKimball Should this be backported to the 22.2.0 branch? SQLancer might be running into the bug: https://github.com/sqlancer/sqlancer/pull/587#issuecomment-1281468873
I wanted to avoid backporting a fix for an old bug, but it's had some time to bake at this point, so I guess we could. How much of a problem are the failures?
Good point. They aren't a huge problem, we can ignore them in SQLancer until v22.2.1 is released.