Re: [PATCHES] [pgsql-patches] scrollable cursor support for plpgsql

2007-02-20 Thread Bruce Momjian

Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---


Pavel Stehule wrote:
 Hello
 
 this patch contains ansi sql scrollable cursors's support for plpgsql. Add 
 three function to SPI and plpgsql scrollable cursor sup. is first test app 
 of this functionality.
 
 Regards
 Pavel Stehule
 
 _
 Citite se osamele? Poznejte nekoho vyjmecneho diky Match.com. 
 http://www.msn.cz/

[ Attachment, skipping... ]

 
 ---(end of broadcast)---
 TIP 6: explain analyze is your friend

-- 
  Bruce Momjian  [EMAIL PROTECTED]  http://momjian.us
  EnterpriseDB   http://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


[pgsql-patches] scrollable cursor support for plpgsql

2007-01-26 Thread Pavel Stehule

Hello

this patch contains ansi sql scrollable cursors's support for plpgsql. Add 
three function to SPI and plpgsql scrollable cursor sup. is first test app 
of this functionality.


Regards
Pavel Stehule

_
Citite se osamele? Poznejte nekoho vyjmecneho diky Match.com. 
http://www.msn.cz/
*** ./doc/src/sgml/plpgsql.sgml.orig	2007-01-26 20:30:17.0 +0100
--- ./doc/src/sgml/plpgsql.sgml	2007-01-26 21:33:38.0 +0100
***
*** 2354,2360 
  internally to avoid memory problems.) A more interesting usage is to
  return a reference to a cursor that a function has created, allowing the
  caller to read the rows. This provides an efficient way to return
! large row sets from functions.
 /para
  
 sect2 id=plpgsql-cursor-declarations
--- 2354,2361 
  internally to avoid memory problems.) A more interesting usage is to
  return a reference to a cursor that a function has created, allowing the
  caller to read the rows. This provides an efficient way to return
! large row sets from functions. PL/pgSQL allows to use scrollable 
! cursors.
 /para
  
 sect2 id=plpgsql-cursor-declarations
***
*** 2368,2374 
   Another way is to use the cursor declaration syntax,
   which in general is:
  synopsis
! replaceablename/replaceable CURSOR optional ( replaceablearguments/replaceable ) /optional FOR replaceablequery/replaceable;
  /synopsis
   (literalFOR/ may be replaced by literalIS/ for
   productnameOracle/productname compatibility.)
--- 2369,2375 
   Another way is to use the cursor declaration syntax,
   which in general is:
  synopsis
! replaceablename/replaceable optional optional NO /optional SCROLL /optional CURSOR optional ( replaceablearguments/replaceable ) /optional FOR replaceablequery/replaceable;
  /synopsis
   (literalFOR/ may be replaced by literalIS/ for
   productnameOracle/productname compatibility.)
***
*** 2517,2523 
   titleliteralFETCH//title
  
  synopsis
! FETCH replaceablecursor/replaceable INTO replaceabletarget/replaceable;
  /synopsis
  
   para
--- 2518,2524 
   titleliteralFETCH//title
  
  synopsis
! FETCH optional replaceabledirection/replaceable FROM /optional replaceablecursor/replaceable INTO replaceabletarget/replaceable;
  /synopsis
  
   para
***
*** 2526,2539 
variable, or a comma-separated list of simple variables, just like
commandSELECT INTO/command.  As with commandSELECT
 INTO/command, the special variable literalFOUND/literal may
!   be checked to see whether a row was obtained or not.
   /para
- 
  para
   An example:
  programlisting
  FETCH curs1 INTO rowvar;
  FETCH curs2 INTO foo, bar, baz;
  /programlisting
 /para
   /sect3
--- 2527,2545 
variable, or a comma-separated list of simple variables, just like
commandSELECT INTO/command.  As with commandSELECT
 INTO/command, the special variable literalFOUND/literal may
!   be checked to see whether a row was obtained or not. More details
! 	  about replaceabledirection/replaceable you can find in
!   xref linkend=sql-fetch without literalBACKWARD/ and literalFORWARD/ keywords.
! 	  Statement commandFETCH/command in applicationPL/pgSQL/ returns only one 
! 	  or zero row every time.
   /para
  para
   An example:
  programlisting
  FETCH curs1 INTO rowvar;
  FETCH curs2 INTO foo, bar, baz;
+ FETCH LAST INTO x, y;
+ FETCH RELATIVE -2 INTO x;
  /programlisting
 /para
   /sect3
*** ./doc/src/sgml/spi.sgml.orig	2007-01-14 12:37:19.0 +0100
--- ./doc/src/sgml/spi.sgml	2007-01-26 11:46:18.0 +0100
***
*** 800,805 
--- 800,937 
  
  !-- *** --
  
+ refentry id=spi-spi-prepare-cursor
+  refmeta
+   refentrytitleSPI_prepare_cursor/refentrytitle
+  /refmeta
+ 
+  refnamediv
+   refnameSPI_prepare_cursor/refname
+   refpurposeprepare a plan for a cursor, without executing it yet/refpurpose
+  /refnamediv
+ 
+  indextermprimarySPI_prepare_cursor/primary/indexterm
+ 
+  refsynopsisdiv
+ synopsis
+ void * SPI_prepare_cursor(const char * parametercommand/parameter, int parameternargs/parameter, Oid * parameterargtypes/parameter, int parameteroptions/parameter)
+ /synopsis
+  /refsynopsisdiv
+ 
+  refsect1
+   titleDescription/title
+ 
+   para
+functionSPI_prepare_cursor/function creates and returns an execution
+plan for the specified select but doesn't execute the command.
+This function should only be called from a connected procedure. This
+function allows set cursor's options. 
+   /para
+ 
+   para
+When the same or a similar command is to be executed repeatedly, it
+may be advantageous to perform the planning only once.
+