88 *
99 *
1010 * IDENTIFICATION
11- * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.238 2009/04/02 19: 20:45 momjian Exp $
11+ * $PostgreSQL: pgsql/src/pl/plpgsql/src/pl_exec.c,v 1.239 2009/04/02 20:16:30 tgl Exp $
1212 *
1313 *-------------------------------------------------------------------------
1414 */
@@ -3284,7 +3284,7 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
32843284 SPITupleTable * tuptab ;
32853285 Portal portal ;
32863286 char * curname ;
3287- int n ;
3287+ uint32 n ;
32883288
32893289 /* ----------
32903290 * Get the portal of the cursor by name
@@ -3342,19 +3342,13 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
33423342 n = SPI_processed ;
33433343
33443344 /* ----------
3345- * Set the target and the global FOUND variable appropriately.
3345+ * Set the target appropriately.
33463346 * ----------
33473347 */
33483348 if (n == 0 )
3349- {
33503349 exec_move_row (estate , rec , row , NULL , tuptab -> tupdesc );
3351- exec_set_found (estate , false);
3352- }
33533350 else
3354- {
33553351 exec_move_row (estate , rec , row , tuptab -> vals [0 ], tuptab -> tupdesc );
3356- exec_set_found (estate , true);
3357- }
33583352
33593353 SPI_freetuptable (tuptab );
33603354 }
@@ -3363,12 +3357,11 @@ exec_stmt_fetch(PLpgSQL_execstate *estate, PLpgSQL_stmt_fetch *stmt)
33633357 /* Move the cursor */
33643358 SPI_scroll_cursor_move (portal , stmt -> direction , how_many );
33653359 n = SPI_processed ;
3366-
3367- /* Set the global FOUND variable appropriately. */
3368- exec_set_found (estate , n != 0 );
33693360 }
33703361
3362+ /* Set the ROW_COUNT and the global FOUND variable appropriately. */
33713363 estate -> eval_processed = n ;
3364+ exec_set_found (estate , n != 0 );
33723365
33733366 return PLPGSQL_RC_OK ;
33743367}
0 commit comments