Fix planning of btree index scans using ScalarArrayOpExpr quals.
In commit 9e8da0f7, I improved btree to handle ScalarArrayOpExpr quals natively, so that constructs like "indexedcol IN (list)" could be supported by index-only scans. Using such a qual results in multiple scans of the index, under-the-hood. I went to some lengths to ensure that this still produces rows in index order ... but I failed to recognize that if a higher-order index column is lacking an equality constraint, rescans can produce out-of-order data from that column. Tweak the planner to not expect sorted output in that case. Per trouble report from Robert McGehee.
Showing
- src/backend/optimizer/path/indxpath.c 14 additions, 1 deletionsrc/backend/optimizer/path/indxpath.c
- src/test/regress/expected/create_index.out 45 additions, 0 deletionssrc/test/regress/expected/create_index.out
- src/test/regress/sql/create_index.sql 24 additions, 0 deletionssrc/test/regress/sql/create_index.sql
Please register or sign in to comment