From 96368b5af3c4186a065770cec96fcb0ea60dafd0 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Wed, 13 Mar 2024 08:45:20 +0900
Subject: [PATCH v6 3/3] Some docs and comments updates

---
 src/backend/commands/copyfromparse.c |  6 ++----
 src/test/regress/expected/copy2.out  | 15 +++++++++------
 src/test/regress/sql/copy2.sql       |  3 +++
 doc/src/sgml/ref/copy.sgml           | 18 ++++++++++--------
 4 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/src/backend/commands/copyfromparse.c b/src/backend/commands/copyfromparse.c
index a7ad6c17c8..44f615de28 100644
--- a/src/backend/commands/copyfromparse.c
+++ b/src/backend/commands/copyfromparse.c
@@ -973,11 +973,9 @@ NextCopyFrom(CopyFromState cstate, ExprContext *econtext,
 
 				if (cstate->opts.log_verbosity == COPY_LOG_VERBOSITY_VERBOSE)
 					ereport(NOTICE,
-							errmsg("detected data type incompatibility at line number %llu for column %s; COPY %s",
+							errmsg("data type incompatibility at line %llu for column \"%s\"",
 								   (unsigned long long) cstate->cur_lineno,
-								   cstate->cur_attname,
-								   cstate->cur_relname));
-
+								   cstate->cur_attname));
 				return true;
 			}
 
diff --git a/src/test/regress/expected/copy2.out b/src/test/regress/expected/copy2.out
index c6655000e4..af669fedbe 100644
--- a/src/test/regress/expected/copy2.out
+++ b/src/test/regress/expected/copy2.out
@@ -739,17 +739,20 @@ ERROR:  invalid input syntax for type integer: "a"
 CONTEXT:  COPY check_ign_err, line 2, column n: "a"
 -- tests for options on_error and log_verbosity
 COPY check_ign_err FROM STDIN WITH (on_error ignore, log_verbosity 'verbose');
-NOTICE:  detected data type incompatibility at line number 2 for column n; COPY check_ign_err
-NOTICE:  detected data type incompatibility at line number 3 for column k; COPY check_ign_err
-NOTICE:  detected data type incompatibility at line number 4 for column m; COPY check_ign_err
-NOTICE:  detected data type incompatibility at line number 5 for column n; COPY check_ign_err
-NOTICE:  4 rows were skipped due to data type incompatibility
+NOTICE:  data type incompatibility at line 2 for column "n"
+NOTICE:  data type incompatibility at line 3 for column "k"
+NOTICE:  data type incompatibility at line 4 for column "m"
+NOTICE:  data type incompatibility at line 5 for column "n"
+NOTICE:  data type incompatibility at line 7 for column "m"
+NOTICE:  data type incompatibility at line 8 for column "k"
+NOTICE:  6 rows were skipped due to data type incompatibility
 SELECT * FROM check_ign_err;
  n |  m  | k 
 ---+-----+---
  1 | {1} | 1
  5 | {5} | 5
-(2 rows)
+ 8 | {8} | 8
+(3 rows)
 
 -- test datatype error that can't be handled as soft: should fail
 CREATE TABLE hard_err(foo widget);
diff --git a/src/test/regress/sql/copy2.sql b/src/test/regress/sql/copy2.sql
index b637a5b3bb..4fb736535d 100644
--- a/src/test/regress/sql/copy2.sql
+++ b/src/test/regress/sql/copy2.sql
@@ -519,6 +519,9 @@ a	{2}	2
 4	{a, 4}	4
 
 5	{5}	5
+6	a
+7	{7}	a
+8	{8}	8
 \.
 SELECT * FROM check_ign_err;
 
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml
index ed7fdc59fb..7d594d275e 100644
--- a/doc/src/sgml/ref/copy.sgml
+++ b/doc/src/sgml/ref/copy.sgml
@@ -402,8 +402,8 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
       emitted at the end of the <command>COPY FROM</command> if at least one
       row was discarded. When <literal>LOG_VERBOSITY</literal> option is set to
       <literal>verbose</literal>, a <literal>NOTICE</literal> message
-      containing the line number and column name (whose input conversion has
-      failed) is emitted for each discarded row.
+      containing the line of the input file and the column name whose input
+      conversion has failed is emitted for each discarded row.
      </para>
     </listitem>
    </varlistentry>
@@ -424,13 +424,15 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable
     <term><literal>LOG_VERBOSITY</literal></term>
     <listitem>
      <para>
-      Sets the verbosity of logged messages by <command>COPY</command> command.
+      Sets the verbosity of some of the messages logged by a
+      <command>COPY</command> command.
       A <replaceable class="parameter">mode</replaceable> value of
-      <literal>verbose</literal> can be used to emit more informative messages
-      by the command, while value of <literal>default</literal> (which is the
-      default) can be used to not log any additional messages. As an example,
-      see its usage for <command>COPY FROM</command> command when
-      <literal>ON_ERROR</literal> option is set to <literal>ignore</literal>.
+      <literal>verbose</literal> can be used to emit more informative messages.
+      <literal>default</literal> will not log any additional messages.
+     </para>
+     <para>
+      This is currently used in <command>COPY FROM</command> command when
+      <literal>ON_ERROR</literal> is set to <literal>ignore</literal>.
      </para>
     </listitem>
    </varlistentry>
-- 
2.43.0

