|
8 | 8 | *
|
9 | 9 | *
|
10 | 10 | * IDENTIFICATION
|
11 |
| - * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.65 2003/05/08 18:16:36 tgl Exp $ |
| 11 | + * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.66 2003/06/12 17:29:26 tgl Exp $ |
12 | 12 | *
|
13 | 13 | *-------------------------------------------------------------------------
|
14 | 14 | */
|
@@ -262,17 +262,19 @@ postquel_getnext(execution_state *es)
|
262 | 262 |
|
263 | 263 | if (es->qd->operation==CMD_UTILITY)
|
264 | 264 | {
|
265 |
| -/* |
266 |
| - * Process a utility command. (create, destroy...)DZ - 30-8-1996 |
267 |
| - */ |
268 | 265 | ProcessUtility(es->qd->parsetree->utilityStmt,es->qd->dest,NULL);
|
269 |
| -if (!LAST_POSTQUEL_COMMAND(es)) |
270 |
| -CommandCounterIncrement(); |
271 | 266 | return (TupleTableSlot*)NULL;
|
272 | 267 | }
|
273 | 268 |
|
274 |
| -/* If it's not the last command, just run it to completion */ |
275 |
| -count= (LAST_POSTQUEL_COMMAND(es)) ?1L :0L; |
| 269 | +/* |
| 270 | + * If it's the function's last command, and it's a SELECT, fetch one |
| 271 | + * row at a time so we can return the results. Otherwise just run it |
| 272 | + * to completion. |
| 273 | + */ |
| 274 | +if (LAST_POSTQUEL_COMMAND(es)&&es->qd->operation==CMD_SELECT) |
| 275 | +count=1L; |
| 276 | +else |
| 277 | +count=0L; |
276 | 278 |
|
277 | 279 | returnExecutorRun(es->qd,ForwardScanDirection,count);
|
278 | 280 | }
|
|