Is it just a plain print to screen? if it is why not simply use simple console print command?
I've looked it up and there isn't much information about it. Even in the official PostgreSQL guide there isn't information about it other than the fact it exists.
Is it preferred to use plpy
module because that way the information to be printed won't be logged in PostgreSQL
log file?
The PL/Python plpy.notice(msg)
method and its cousins, plpy.debug(msg)
, plpy.log(msg)
, plpy.info(msg)
, plpy.warning(msg)
, plpy.error(msg)
, and plpy.fatal(msg)
are used to generate messages using PostgreSQL's logging capabilities. The error
and fatal
variants also raise an exception which can be used to abort the current SQL transaction. plpy.notice(msg)
is equivalent to the PL/PgSQL command RAISE NOTICE msg
.
According to the PostgreSQL 9.4 documentation http://www.postgresql.org/docs/9.4/static/plpython-util.html, the destination of log messages at various levels can be controlled via database configuration variables. For example, you can specify that you only want messages of at least WARNING
level to be dispatched to the client, but anything from NOTICE
and above to be logged to the server log. This has been the case at least back to PostgreSQL 8.0.