"Bruce Toll" <bt...@dhsus.com> writes:
> I encountered a problem that will hopefully be
> easy for you to reproduce using psql with the
> snippet below.

Sigh ... I could've sworn I tested that code path, but evidently not,
'cause it's broken as can be.

*** src/backend/optimizer/plan/planner.c.orig   Fri Jan  9 10:46:10 2009
--- src/backend/optimizer/plan/planner.c        Tue Mar 24 17:03:03 2009
***************
*** 2546,2553 ****
                        if (list_length(new_pathkeys) > list_length(pathkeys))
                        {
                                /* this sort clause is actually significant */
!                               *partColIdx[*partNumCols] = sortColIdx[scidx++];
!                               *partOperators[*partNumCols] = sgc->eqop;
                                (*partNumCols)++;
                                pathkeys = new_pathkeys;
                        }
--- 2546,2553 ----
                        if (list_length(new_pathkeys) > list_length(pathkeys))
                        {
                                /* this sort clause is actually significant */
!                               (*partColIdx)[*partNumCols] = 
sortColIdx[scidx++];
!                               (*partOperators)[*partNumCols] = sgc->eqop;
                                (*partNumCols)++;
                                pathkeys = new_pathkeys;
                        }
***************
*** 2565,2572 ****
                        if (list_length(new_pathkeys) > list_length(pathkeys))
                        {
                                /* this sort clause is actually significant */
!                               *ordColIdx[*ordNumCols] = sortColIdx[scidx++];
!                               *ordOperators[*ordNumCols] = sgc->eqop;
                                (*ordNumCols)++;
                                pathkeys = new_pathkeys;
                        }
--- 2565,2572 ----
                        if (list_length(new_pathkeys) > list_length(pathkeys))
                        {
                                /* this sort clause is actually significant */
!                               (*ordColIdx)[*ordNumCols] = sortColIdx[scidx++];
!                               (*ordOperators)[*ordNumCols] = sgc->eqop;
                                (*ordNumCols)++;
                                pathkeys = new_pathkeys;
                        }


Thanks for the report!

                        regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to