The plpy module also provides the
functions plpy.debug(msg), plpy.log(msg),
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
equivalent to calling
plpy.fatal, respectively. The
other functions only 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
configuration variables. See Chapter 18 for more information.
Another set of utility functions are plpy.quote_literal(string), plpy.quote_nullable(string), and plpy.quote_ident(string). They are equivalent to the built-in quoting functions described in Section 9.4. They are useful when constructing ad-hoc queries. A PL/Python equivalent of dynamic SQL from Example 40-1 would be:
plpy.execute("UPDATE tbl SET %s = %s WHERE key = %s" % ( plpy.quote_ident(colname), plpy.quote_nullable(newvalue), plpy.quote_literal(keyvalue)))
Please use this form to add your own comments regarding your experience with particular features of PostgreSQL, clarifications of the documentation, or hints for other users. Please note, this is not a support forum, and your IP address will be logged. If you have a question or need help, please see the faq, try a mailing list, or join us on IRC. Note that submissions containing URLs or other keywords commonly found in 'spam' comments may be silently discarded. Please contact the webmaster if you think this is happening to you in error.
Proceed to the comment form.