(unnamed)

text/plain

Filename: (unnamed)
Type: text/plain
Part: 0
Message: Re: move 0 behaviour
Index: doc/src/sgml/ref/move.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/move.sgml,v
retrieving revision 1.13
diff -c -c -r1.13 move.sgml
*** doc/src/sgml/ref/move.sgml	21 Apr 2002 19:02:39 -0000	1.13
--- doc/src/sgml/ref/move.sgml	26 Oct 2002 20:01:15 -0000
***************
*** 37,44 ****
     <command>MOVE</command> allows a user to move cursor position a specified
     number of rows.
     <command>MOVE</command> works like the <command>FETCH</command> command,
!    but only positions the cursor and does
!    not return rows.
    </para>
    <para>
     Refer to 
--- 37,44 ----
     <command>MOVE</command> allows a user to move cursor position a specified
     number of rows.
     <command>MOVE</command> works like the <command>FETCH</command> command,
!    but only positions the cursor and does not return rows. The special
!    direction <literal>0</> moves to the end of the cursor.
    </para>
    <para>
     Refer to 
Index: src/backend/executor/execMain.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/executor/execMain.c,v
retrieving revision 1.180
diff -c -c -r1.180 execMain.c
*** src/backend/executor/execMain.c	14 Oct 2002 16:51:30 -0000	1.180
--- src/backend/executor/execMain.c	26 Oct 2002 20:01:20 -0000
***************
*** 1119,1125 ****
  
  		/*
  		 * check our tuple count.. if we've processed the proper number
! 		 * then quit, else loop again and process more tuples..
  		 */
  		current_tuple_count++;
  		if (numberTuples == current_tuple_count)
--- 1119,1127 ----
  
  		/*
  		 * check our tuple count.. if we've processed the proper number
! 		 * then quit, else loop again and process more tuples.
! 		 * If numberTuples is zero, it means we have done MOVE 0
! 		 * or FETCH ALL and we want to go to the end of the portal.
  		 */
  		current_tuple_count++;
  		if (numberTuples == current_tuple_count)
Index: src/backend/tcop/utility.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/tcop/utility.c,v
retrieving revision 1.180
diff -c -c -r1.180 utility.c
*** src/backend/tcop/utility.c	21 Oct 2002 20:31:52 -0000	1.180
--- src/backend/tcop/utility.c	26 Oct 2002 20:01:29 -0000
***************
*** 263,270 ****
  
  				/*
  				 * parser ensures that count is >= 0 and 'fetch ALL' -> 0
  				 */
- 
  				count = stmt->howMany;
  				PerformPortalFetch(portalName, forward, count,
  								   (stmt->ismove) ? None : dest,
--- 263,270 ----
  
  				/*
  				 * parser ensures that count is >= 0 and 'fetch ALL' -> 0
+ 				 * MOVE 0 is equivalent to fetch ALL with no returned tuples.
  				 */
  				count = stmt->howMany;
  				PerformPortalFetch(portalName, forward, count,
  								   (stmt->ismove) ? None : dest,