From e7834a1a251d4a28245377f383ff20a657ba8262 Mon Sep 17 00:00:00 2001
From: Fujii Masao
Date: Thu, 3 Oct 2024 15:55:37 +0900
Subject: Add log_verbosity = 'silent' support to COPY command.
Previously, when the on_error option was set to ignore, the COPY command
would always log NOTICE messages for input rows discarded due to
data type incompatibility. Users had no way to suppress these messages.
This commit introduces a new log_verbosity setting, 'silent',
which prevents the COPY command from emitting NOTICE messages
when on_error = 'ignore' is used, even if rows are discarded.
This feature is particularly useful when processing malformed files
frequently, where a flood of NOTICE messages can be undesirable.
For example, when frequently loading malformed files via the COPY command
or querying foreign tables using file_fdw (with an upcoming patch to
add on_error support for file_fdw), users may prefer to suppress
these messages to reduce log noise and improve clarity.
Author: Atsushi Torikoshi
Reviewed-by: Masahiko Sawada, Fujii Masao
Discussion: https://postgr.es/m/ab59dad10490ea3734cf022b16c24cfd@oss.nttdata.com
---
doc/src/sgml/ref/copy.sgml | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
(limited to 'doc/src')
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index 33633447f16..b9413d48925 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -407,6 +407,8 @@ COPY { table_name [ ( verbose, a NOTICE message
containing the line of the input file and the column name whose input
conversion has failed is emitted for each discarded row.
+ When it is set to silent, no message is emitted
+ regarding ignored rows.
@@ -428,9 +430,11 @@ COPY { table_name [ (
Specifies the amount of messages emitted by a COPY
- command: default or verbose. If
- verbose is specified, additional messages are emitted
- during processing.
+ command: default, verbose, or
+ silent.
+ If verbose is specified, additional messages are
+ emitted during processing.
+ silent suppresses both verbose and default messages.
This is currently used in COPY FROM command when
--
cgit v1.2.3