Prevent remote notices from repeating local query details in logs

Since 112faf1378ee, NOTICE, WARNING, and similar messages received through
dblink, postgres_fdw, and replication connections have been logged with
ereport(LOG). With the default log_min_error_statement setting, each
such log entry can also include the current local SQL statement. An active
error-context callback can add local CONTEXT information as well. Repeating
these fields for every remote message increases log volume and processing
overhead.

Use errhidestmt() and errhidecontext() when logging these messages to
prevent the local STATEMENT and CONTEXT fields, when present, from being
repeated for each remote message in the server log.

Reported-by: Merlin Moncure <[email protected]>
Author: Vignesh C <[email protected]
Reviewed-by: Merlin Moncure <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: 
https://postgr.es/m/CAHyXU0yDwOYkWpRi=gtpdwjbxvqeaezgkgzlrwm2p1_fgai...@mail.gmail.com
Backpatch-though: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6a2edf2a1e6d0c277b7ddf9604fe5b83766cc8e1

Modified Files
--------------
src/include/libpq/libpq-be-fe-helpers.h | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Reply via email to