From 6ab1d7a8dd1f4df4402c726441bb6f36bb5e2f54 Mon Sep 17 00:00:00 2001 From: Catalin Iacob Date: Thu, 25 Feb 2016 07:02:18 +0100 Subject: [PATCH] Doc improvements --- doc/src/sgml/plpython.sgml | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/doc/src/sgml/plpython.sgml b/doc/src/sgml/plpython.sgml index 7d31342..4ed34d6 100644 --- a/doc/src/sgml/plpython.sgml +++ b/doc/src/sgml/plpython.sgml @@ -1341,22 +1341,23 @@ $$ LANGUAGE plpythonu; Utility Functions The plpy module also provides the functions - plpy.debug(exception_params), - plpy.log(exception_params), - plpy.info(exception_params), - plpy.notice(exception_params), - plpy.warning(exception_params), - plpy.error(exception_params), and - plpy.fatal(exception_params).elogin PL/Python + plpy.debug(msg, **kwargs), + plpy.log(msg, **kwargs), + plpy.info(msg, **kwargs), + plpy.notice(msg, **kwargs), + plpy.warning(msg, **kwargs), + plpy.error(msg, **kwargs), and + plpy.fatal(msg, **kwargs).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 - partial equivalent to calling - plpy.error and - plpy.fatal, respectively. + equivalent to calling + plpy.error(msg) and + plpy.fatal(msg), respectively but + the raise form does not allow passing keyword arguments. The other functions only generate messages of different priority levels. Whether messages of a particular priority are reported to the client, @@ -1368,11 +1369,14 @@ $$ LANGUAGE plpythonu; - The exception_params are - [ message [, detail [, hint [, sqlstate [, schema [, table [, column [, datatype [, constraint ]]]]]]]]]. - These parameters kan be entered as keyword parameters. - The message, detail, hint - are automaticly casted to string, other should be string. + The msg argument is given as a positional argument. For + backward compatibility, more than one positional argument can be given. In + that case, the string representation of the tuple of positional arguments + becomes the message reported to the client. + The following keyword-only arguments are accepted: + detail, hint, sqlstate, schema, table, column, datatype , constraint. + The string representation of the objects passed as keyword-only arguments + is used to enrich the messages reported to the client. For example: CREATE FUNCTION raise_custom_exception() RETURNS void AS $$ -- 2.7.1