This patch includes some minor fixes and improvements to the SGML docs
authorBruce Momjian
Wed, 15 Jan 2003 16:40:24 +0000 (16:40 +0000)
committerBruce Momjian
Wed, 15 Jan 2003 16:40:24 +0000 (16:40 +0000)
for PL/PgSQL.

Neil Conway

doc/src/sgml/plpgsql.sgml

index 43d00d68f0e0d8a0d69f346cd22778059e94849e..30adbd1dd9b6745e4b88810d22564b3a4dc0b09a 100644 (file)
@@ -1,5 +1,5 @@
 
 
  
@@ -68,6 +68,7 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.12 2002/11/23 03:59:05 mom
     SQL expressions and SQL queries
     used in the function are not translated immediately.
    
+
    
     As each expression and SQL query is first used
    in the function, the PL/pgSQL interpreter creates
@@ -84,12 +85,13 @@ $Header: /cvsroot/pgsql/doc/src/sgml/plpgsql.sgml,v 1.12 2002/11/23 03:59:05 mom
    that errors in a specific expression or query may not be detected
    until that part of the function is reached in execution.
    
-  
-   Once PL/pgSQL has made a query plan for a particular
-   query in a function, it will re-use that plan for the life of the
-   database connection.  This is usually a win for performance, but it
-   can cause some problems if you dynamically
-   alter your database schema. For example:
+
+   
+    Once PL/pgSQL has made a query plan for a particular
+    query in a function, it will re-use that plan for the life of the
+    database connection.  This is usually a win for performance, but it
+    can cause some problems if you dynamically
+    alter your database schema. For example:
 
 
 CREATE FUNCTION populate() RETURNS INTEGER AS '
@@ -100,6 +102,7 @@ BEGIN
 END;
 ' LANGUAGE 'plpgsql';
 
+
     If you execute the above function, it will reference the OID for
     my_function() in the query plan produced for
     the PERFORM statement. Later, if you
@@ -107,7 +110,11 @@ END;
     populate() will not be able to find
     my_function() anymore. You would then have to
     re-create populate(), or at least start a new
-    database session so that it will be compiled afresh.
+    database session so that it will be compiled afresh. Another way
+    to avoid this problem is to use CREATE OR REPLACE
+    FUNCTION when updating the definition of
+    my_function (when a function is
+    replaced, its OID is not changed).
    
 
    
@@ -221,35 +228,17 @@ END;
    Developing in <application>PL/pgSQL</application>
 
    
-    Developing in PL/pgSQL is pretty straight forward, especially
-    if you have developed in other database procedural languages,
-    such as Oracle's PL/SQL. Two good ways of developing in
-    PL/pgSQL are:
-
-    
-     
-      
-       Using a text editor and reloading the file with psql
-      
-     
-
-     
-      
-       Using PostgreSQL's GUI Tool: PgAccess
-      
-     
-    
-   
-
-   
-    One good way to develop in PL/pgSQL is to simply
-    use the text editor of your choice to create your functions, and
-    in another window, use psql
-    (PostgreSQL's interactive monitor) to load those
-    functions. If you are doing it this way, it is a good idea to
-    write the function using CREATE OR REPLACE
-    FUNCTION. That way you can reload the file to update the
-    function definition.  For example:
+    Developing in PL/pgSQL is pretty
+    straight forward, especially if you have developed in other
+    database procedural languages, such as Oracle's
+    PL/SQL.  One good way to develop in
+    PL/pgSQL is to simply use the text editor of your
+    choice to create your functions, and in another window, use
+    psql (PostgreSQL's interactive
+    monitor) to load those functions. If you are doing it this way, it
+    is a good idea to write the function using CREATE OR
+    REPLACE FUNCTION. That way you can reload the file to update
+    the function definition.  For example:
 
 CREATE OR REPLACE FUNCTION testfunc(INTEGER) RETURNS INTEGER AS '
      ....
@@ -268,10 +257,12 @@ end;
    
 
    
-    Another good way to develop in PL/pgSQL is using
-    PostgreSQL's GUI tool: PgAccess. It does some
-    nice things for you, like escaping single-quotes, and making
-    it easy to recreate and debug functions.
+    Another good way to develop in PL/pgSQL is using a
+    GUI database access tool that facilitates development in a
+    procedural language. One example of such as a tool is
+    PgAccess, although others exist. These tools often
+    provide convenient features such as escaping single-quotes, and
+    making it easier to recreate and debug functions.