From 1d5e0a79ee33d1580f31d673f5b3cdb0046576d2 Mon Sep 17 00:00:00 2001 From: Joel Jacobson Date: Tue, 15 Oct 2024 02:38:39 +0200 Subject: [PATCH 13/16] Separate FREEZE option validation into its own section. --- src/backend/commands/copy.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index b5e224ee6b..484da6fd85 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -913,6 +913,18 @@ ProcessCopyOptions(ParseState *pstate, "COPY TO"))); } + /* --- FREEZE option --- */ + if (opts_out->freeze) + { + if (!is_from) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR, + second %s is a COPY with direction, e.g. COPY TO */ + errmsg("COPY %s cannot be used with %s", "FREEZE", + "COPY TO"))); + } + /* * Check for incompatible options (must do these three before inserting * defaults) @@ -957,15 +969,6 @@ ProcessCopyOptions(ParseState *pstate, "NULL"))); } - /* Check freeze */ - if (opts_out->freeze && !is_from) - ereport(ERROR, - (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR, - second %s is a COPY with direction, e.g. COPY TO */ - errmsg("COPY %s cannot be used with %s", "FREEZE", - "COPY TO"))); - /* Check on_error */ if (opts_out->format == COPY_FORMAT_BINARY && opts_out->on_error != COPY_ON_ERROR_STOP) -- 2.45.1