aboutsummaryrefslogtreecommitdiff
path: root/src/include/commands/copy.h
diff options
context:
space:
mode:
authorMasahiko Sawada <msawada@postgresql.org>2024-04-01 15:25:25 +0900
committerMasahiko Sawada <msawada@postgresql.org>2024-04-01 15:25:25 +0900
commitf5a227895e178bf528b18f82bbe554435fb3e64f (patch)
treec93d52125f449f8f37382ca933af617182cb9130 /src/include/commands/copy.h
parentf4ad0021aface01ee74604355bd2e998e5f73320 (diff)
downloadpostgresql-f5a227895e178bf528b18f82bbe554435fb3e64f.tar.gz
postgresql-f5a227895e178bf528b18f82bbe554435fb3e64f.zip
Add new COPY option LOG_VERBOSITY.
This commit adds a new COPY option LOG_VERBOSITY, which controls the amount of messages emitted during processing. Valid values are 'default' and 'verbose'. This is currently used in COPY FROM when ON_ERROR option is set to ignore. If 'verbose' is specified, a NOTICE message is emitted for each discarded row, providing additional information such as line number, column name, and the malformed value. This helps users to identify problematic rows that failed to load. Author: Bharath Rupireddy Reviewed-by: Michael Paquier, Atsushi Torikoshi, Masahiko Sawada Discussion: https://www.postgresql.org/message-id/CALj2ACUk700cYhx1ATRQyRw-fBM%2BaRo6auRAitKGff7XNmYfqQ%40mail.gmail.com
Diffstat (limited to 'src/include/commands/copy.h')
-rw-r--r--src/include/commands/copy.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/include/commands/copy.h b/src/include/commands/copy.h
index b3da3cb0be7..141fd48dc10 100644
--- a/src/include/commands/copy.h
+++ b/src/include/commands/copy.h
@@ -41,6 +41,15 @@ typedef enum CopyOnErrorChoice
} CopyOnErrorChoice;
/*
+ * Represents verbosity of logged messages by COPY command.
+ */
+typedef enum CopyLogVerbosityChoice
+{
+ COPY_LOG_VERBOSITY_DEFAULT = 0, /* logs no additional messages, default */
+ COPY_LOG_VERBOSITY_VERBOSE, /* logs additional messages */
+} CopyLogVerbosityChoice;
+
+/*
* A struct to hold COPY options, in a parsed form. All of these are related
* to formatting, except for 'freeze', which doesn't really belong here, but
* it's expedient to parse it along with all the other options.
@@ -73,6 +82,7 @@ typedef struct CopyFormatOptions
bool *force_null_flags; /* per-column CSV FN flags */
bool convert_selectively; /* do selective binary conversion? */
CopyOnErrorChoice on_error; /* what to do when error happened */
+ CopyLogVerbosityChoice log_verbosity; /* verbosity of logged messages */
List *convert_select; /* list of column names (can be NIL) */
} CopyFormatOptions;
@@ -97,6 +107,7 @@ extern bool NextCopyFrom(CopyFromState cstate, ExprContext *econtext,
extern bool NextCopyFromRawFields(CopyFromState cstate,
char ***fields, int *nfields);
extern void CopyFromErrorCallback(void *arg);
+extern char *CopyLimitPrintoutLength(const char *str);
extern uint64 CopyFrom(CopyFromState cstate);