Re: [DOCS] [PATCH] Fix documentation about PL/Python exception handling

2010-11-14 Thread Marti Raudsepp
On Wed, Nov 10, 2010 at 16:07, Euler Taveira de Oliveira
 wrote:
> Sure. But bear in mind that we don't usually backpatch documentation unless
> there is incorrect information; improvement belongs to HEAD.

Yeah, it is quite incorrect (as you can see by comparing test results
from 1st post with the documentation).

Attached is a documentation patch that will apply to PostgreSQL 8.1 - 8.4

Regards,
Marti
From 190d58287b750ad7492485faaf829f262b93e39e Mon Sep 17 00:00:00 2001
From: Marti Raudsepp 
Date: Sun, 14 Nov 2010 11:24:43 +0200
Subject: [PATCH] Document current PL/Python exception raising semantics

---
 doc/src/sgml/plpython.sgml |   30 --
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml
index 4944b8a..d567f10 100644
--- a/doc/src/sgml/plpython.sgml
+++ b/doc/src/sgml/plpython.sgml
@@ -428,16 +428,7 @@ $$ LANGUAGE plpythonu;
plpy.warning(msg),
plpy.error(msg), and
plpy.fatal(msg).elogin PL/Python
-   plpy.error and 
-   plpy.fatal actually raise a Python exception
-   which, if uncaught, propagates out to the calling query, causing
-   the current transaction or subtransaction to be aborted. 
-   raise plpy.ERROR(msg) and
-   raise plpy.FATAL(msg) are
-   equivalent to calling
-   plpy.error and
-   plpy.fatal, respectively.
-   The other functions only generate messages of different
+   These functions generate messages of different
priority levels.
Whether messages of a particular priority are reported to the client,
written to the server log, or both is controlled by the
@@ -536,6 +527,25 @@ $$ LANGUAGE plpythonu;
struct, time, whrandom, and
zlib.
   
+
+  
+   The plpy.error function actually raises a Python
+   exception which propagates out to the calling query, causing the current
+   transaction or subtransaction to be aborted.  If multiple calls are made,
+   only the last message is reported.  The exception has caveats: these errors
+   cannot be silenced by an except block, and Python exceptions raised in
+   except blocks will not be reported.  The plpy.fatal
+   function immediately aborts execution and terminates the client connection.
+  
+
+  
+   To raise catchable errors, use
+   raise plpy.Error(msg),
+   raise plpy.Fatal(msg) or native Python
+   exceptions.  These have Python exception semantics.  However, an unhandled
+   plpy.Fatal will still cause a PostgreSQL ERROR message to
+   be emitted.
+  
  
 
 ]]>
-- 
1.7.3.2


-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Re: [DOCS] Large SGML Cleanup

2010-11-14 Thread Josh Kupershmidt
[Sorry, I'm revisiting this topic a bit late.. have had a lot of stuff
keeping me busy]

On Wed, Nov 3, 2010 at 10:24 AM, Peter Eisentraut  wrote:
> In general, I think the more efficient way to address this overall
> problem is to run the resulting HTML through tidy and be done with it.

Running tidy -modify on the .html files in ./sgml/html/ gets the
number of invalid HTML files down to 4 from 224 [1]. I took a quick
look at a few of the resulting pages in Firefox, and couldn't see any
visual difference between the original and tidy'ed versions.

I think it would be a good idea to add a step in ./sgml/Makefile to
run tidy on all the .html files produced. Anyone interested in doing
this?

Josh

[1] For reference, the 4 remaining invalid files are: index.html,
functions-string.html, biblio.html, and ecpg-variables.html

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs


Re: [DOCS] Large SGML Cleanup

2010-11-14 Thread Tom Lane
Josh Kupershmidt  writes:
> I think it would be a good idea to add a step in ./sgml/Makefile to
> run tidy on all the .html files produced. Anyone interested in doing
> this?

I'm a bit concerned about starting to depend on tidy as part of our
build process, because the upstream project seems in, um, rather un-tidy
shape.  I see that it's packaged for Fedora so it wouldn't be any skin
off my own nose to get it on the machine I build the docs on.  But
people who have to install it from source will be quite unhappy, because
there doesn't appear to have been an actual release in some time, maybe
not ever (the Fedora package is based on a random CVS pull, not a
published release tarball).  Note the negative comments here:

http://sourceforge.net/projects/tidy/

IOW, I don't mind if you run the html files through tidy on your own
accord, but I don't think I want it done in the Makefiles.

regards, tom lane

-- 
Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs