🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 43.9\. Utility Functions The `plpy` module also provides the functions `plpy.debug(``_msg_`), `plpy.log(``_msg_`), `plpy.info(``_msg_`), `plpy.notice(``_msg_`), `plpy.warning(``_msg_`), `plpy.error(``_msg_`), and `plpy.fatal(``_msg_`). `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 priority levels. Whether messages of a particular priority are reported to the client, written to the server log, or both is controlled by the [log_min_messages](#calibre_link-1449) and [client_min_messages](#calibre_link-1448) configuration variables. See [Chapter 18](#calibre_link-500) 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](#calibre_link-1578). They are useful when constructing ad-hoc queries. A PL/Python equivalent of dynamic SQL from [Example 40-1](#calibre_link-1702) would be: ``` plpy.execute("UPDATE tbl SET %s = %s WHERE key = %s" % ( plpy.quote_ident(colname), plpy.quote_nullable(newvalue), plpy.quote_literal(keyvalue))) ```