]> granicus.if.org Git - postgresql/commitdiff
Improve commentary in match_pathkeys_to_index().
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 16 Mar 2012 18:07:21 +0000 (14:07 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 16 Mar 2012 18:07:21 +0000 (14:07 -0400)
For a little while there I thought match_pathkeys_to_index() was broken
because it wasn't trying to match index columns to pathkeys in order.
Actually that's correct, because GiST can support ordering operators
on any random collection of index columns, but it sure needs a comment.

src/backend/optimizer/path/indxpath.c

index 89b42da6b46517d86ffebe882348aa7376520b81..e23cc5eb7b2b38d5eabc34a30ad9e8d9f024d548 100644 (file)
@@ -2174,6 +2174,13 @@ match_pathkeys_to_index(IndexOptInfo *index, List *pathkeys,
                        if (!bms_equal(member->em_relids, index->rel->relids))
                                continue;
 
+                       /*
+                        * We allow any column of the index to match each pathkey; they
+                        * don't have to match left-to-right as you might expect.  This
+                        * is correct for GiST, which is the sole existing AM supporting
+                        * amcanorderbyop.  We might need different logic in future for
+                        * other implementations.
+                        */
                        for (indexcol = 0; indexcol < index->ncolumns; indexcol++)
                        {
                                Expr       *expr;