Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
87562: opt: add scan constant columns to ordering if they are in the output r=DrewKimball a=DrewKimball Previously when building the provided ordering for a constrained scan, any columns proven to be constant by the constraint were ignored. This allows the optimizer to prove that the scan can provide orderings that omit those columns. However, in the case when one of these columns is an output column and the functional dependencies do not show it as constant, an internal error will result. This happens because the provided ordering omits the constant column, but the functional dependencies cannot later be used to show that the column was optional when checking whether the required ordering is satisfied. This commit modifies the logic to only avoid considering constrained-constant index columns to be added to the provided ordering when they are not output columns. Fixes #83793 Release note (bug fix): fixed a bug introduced in 21.2 that could cause an internal error in rare cases when a query required a constrained index scan to return results in order. Co-authored-by: DrewKimball <[email protected]>
- Loading branch information