I want to turn on logging of all SQL statements that modify the database. I could get that on my own machine by setting the log_statement flag in the configuration file, but it needs to be enabled on the user's machine. How do you enable it from program code? (I'm using Python with psycopg2 if it matters.)
+1
A:
The "it needs to be enabled on the user's machine" phrase is confusing, indeed... I assume you mean "from the user (client) side".
In Postgresql some server run-time parameters can be changed from a connection, but only from a superuser - and only for those settings that do not require a server restart. I'm not sure if that includes the many log options. You might try with something like:
SELECT set_config('log_XXX', 'off', false);
where log_XXX
is to be replaced by the respective logging setting, and 'false
' by the value you want to set.
If that does not work, I guess you are out of luck.
leonbloy
2010-05-23 00:15:20