@@ -1559,6 +1559,7 @@ update_frameheadpos(WindowAggState *winstate)
1559
1559
* reach end of partition, we will leave frameheadpos = end+1 and
1560
1560
* framehead_slot empty.
1561
1561
*/
1562
+ int sortCol = node -> ordColIdx [0 ];
1562
1563
bool sub ,
1563
1564
less ;
1564
1565
@@ -1593,9 +1594,9 @@ update_frameheadpos(WindowAggState *winstate)
1593
1594
bool headisnull ,
1594
1595
currisnull ;
1595
1596
1596
- headval = slot_getattr (winstate -> framehead_slot , 1 ,
1597
+ headval = slot_getattr (winstate -> framehead_slot , sortCol ,
1597
1598
& headisnull );
1598
- currval = slot_getattr (winstate -> ss .ss_ScanTupleSlot , 1 ,
1599
+ currval = slot_getattr (winstate -> ss .ss_ScanTupleSlot , sortCol ,
1599
1600
& currisnull );
1600
1601
if (headisnull || currisnull )
1601
1602
{
@@ -1809,6 +1810,7 @@ update_frametailpos(WindowAggState *winstate)
1809
1810
* necessary. Note that if we reach end of partition, we will
1810
1811
* leave frametailpos = end+1 and frametail_slot empty.
1811
1812
*/
1813
+ int sortCol = node -> ordColIdx [0 ];
1812
1814
bool sub ,
1813
1815
less ;
1814
1816
@@ -1843,9 +1845,9 @@ update_frametailpos(WindowAggState *winstate)
1843
1845
bool tailisnull ,
1844
1846
currisnull ;
1845
1847
1846
- tailval = slot_getattr (winstate -> frametail_slot , 1 ,
1848
+ tailval = slot_getattr (winstate -> frametail_slot , sortCol ,
1847
1849
& tailisnull );
1848
- currval = slot_getattr (winstate -> ss .ss_ScanTupleSlot , 1 ,
1850
+ currval = slot_getattr (winstate -> ss .ss_ScanTupleSlot , sortCol ,
1849
1851
& currisnull );
1850
1852
if (tailisnull || currisnull )
1851
1853
{
0 commit comments