On Sat, Oct 28, 2023 at 08:38:26PM -0400, Bruce Momjian wrote: > I would like to apply the attached patch to master. Looking at your > adjustments for ERRCODE_FEATURE_NOT_SUPPORTED to > ERRCODE_INVALID_PARAMETER_VALUE, I only changed the cases where it would > be illogical to implement the feature, not just that we have no > intention of implementing the feature. I read "invalid" as "illogical".
My apologies, wrong patch attached, right one attached now. -- Bruce Momjian <br...@momjian.us> https://momjian.us EDB https://enterprisedb.com Only you can decide what is important to you.
diff --git a/doc/src/sgml/ref/copy.sgml b/doc/src/sgml/ref/copy.sgml index d12ba96497..82b65543c3 100644 --- a/doc/src/sgml/ref/copy.sgml +++ b/doc/src/sgml/ref/copy.sgml @@ -224,6 +224,7 @@ COPY { <replaceable class="parameter">table_name</replaceable> [ ( <replaceable open and there are no older snapshots held by this transaction. It is currently not possible to perform a <command>COPY FREEZE</command> on a partitioned table. + This option is allowed only in <command>COPY FROM</command>. </para> <para> Note that all other sessions will immediately be able to see the data diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index c5d7d78645..4c23c133e1 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -617,7 +617,7 @@ ProcessCopyOptions(ParseState *pstate, /* Only single-byte delimiter strings are supported. */ if (strlen(opts_out->delim) != 1) ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("COPY delimiter must be a single one-byte character"))); /* Disallow end-of-line characters */ @@ -728,16 +728,22 @@ ProcessCopyOptions(ParseState *pstate, /* Don't allow the delimiter to appear in the null string. */ if (strchr(opts_out->null_print, opts_out->delim[0]) != NULL) ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("COPY delimiter must not appear in the NULL specification"))); /* Don't allow the CSV quote char to appear in the null string. */ if (opts_out->csv_mode && strchr(opts_out->null_print, opts_out->quote[0]) != NULL) ereport(ERROR, - (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("CSV quote character must not appear in the NULL specification"))); + /* Check freeze */ + if (opts_out->freeze && !is_from) + ereport(ERROR, + (errcode(ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("COPY freeze only available using COPY FROM"))); + if (opts_out->default_print) { if (!is_from)