|
7 | 7 | * |
8 | 8 | * |
9 | 9 | * IDENTIFICATION |
10 | | - * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.12 1998/01/07 21:02:56momjian Exp $ |
| 10 | + * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.13 1998/02/23 06:26:56vadim Exp $ |
11 | 11 | * |
12 | 12 | *------------------------------------------------------------------------- |
13 | 13 | */ |
@@ -183,8 +183,6 @@ ExecSort(Sort *node) |
183 | 183 | else |
184 | 184 | { |
185 | 185 | slot= (TupleTableSlot*)sortstate->csstate.cstate.cs_ResultTupleSlot; |
186 | | -/* *** get_cs_ResultTupleSlot((CommonState) sortstate); */ |
187 | | -/*slot =sortstate->csstate.css_ScanTupleSlot; orig */ |
188 | 186 | } |
189 | 187 |
|
190 | 188 | SO1_printf("ExecSort: %s\n", |
@@ -390,3 +388,28 @@ ExecSortRestrPos(Sort *node) |
390 | 388 | */ |
391 | 389 | psort_restorepos(node); |
392 | 390 | } |
| 391 | + |
| 392 | +void |
| 393 | +ExecReScanSort(Sort*node,ExprContext*exprCtxt,Plan*parent) |
| 394 | +{ |
| 395 | +SortState*sortstate=node->sortstate; |
| 396 | + |
| 397 | +/* |
| 398 | + * If we haven't sorted yet, just return. If outerplan' |
| 399 | + * chgParam is not NULL then it will be re-scanned by |
| 400 | + * ExecProcNode, else - no reason to re-scan it at all. |
| 401 | + */ |
| 402 | +if (sortstate->sort_Flag== false) |
| 403 | +return; |
| 404 | + |
| 405 | +ExecClearTuple(sortstate->csstate.cstate.cs_ResultTupleSlot); |
| 406 | + |
| 407 | +psort_rescan (node); |
| 408 | + |
| 409 | +/* |
| 410 | + * If subnode is to be rescanned then we aren't sorted |
| 411 | + */ |
| 412 | +if (((Plan*)node)->lefttree->chgParam!=NULL) |
| 413 | +sortstate->sort_Flag= false; |
| 414 | + |
| 415 | +} |