Re: BUG #4728: segfault with window function partition involving subquery

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Bruce Toll" <btoll(at)dhsus(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4728: segfault with window function partition involving subquery
Date: 2009-03-24 21:11:49
Message-ID: 8549.1237929109@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Bruce Toll" <btoll(at)dhsus(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Bruce Toll 2009-03-24 23:34:42 Re: BUG #4728: segfault with window function partition involving subquery
Previous Message Bruce Toll 2009-03-24 19:32:51 BUG #4728: segfault with window function partition involving subquery