@@ -671,7 +671,7 @@ ProcessCopyOptions(ParseState *pstate,
671
671
if (!opts_out -> csv_mode && opts_out -> quote != NULL )
672
672
ereport (ERROR ,
673
673
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
674
- errmsg ("COPY quote available only in CSV mode" )));
674
+ errmsg ("COPY QUOTE requires CSV mode" )));
675
675
676
676
if (opts_out -> csv_mode && strlen (opts_out -> quote ) != 1 )
677
677
ereport (ERROR ,
@@ -687,7 +687,7 @@ ProcessCopyOptions(ParseState *pstate,
687
687
if (!opts_out -> csv_mode && opts_out -> escape != NULL )
688
688
ereport (ERROR ,
689
689
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
690
- errmsg ("COPY escape available only in CSV mode" )));
690
+ errmsg ("COPY ESCAPE requires CSV mode" )));
691
691
692
692
if (opts_out -> csv_mode && strlen (opts_out -> escape ) != 1 )
693
693
ereport (ERROR ,
@@ -698,46 +698,52 @@ ProcessCopyOptions(ParseState *pstate,
698
698
if (!opts_out -> csv_mode && (opts_out -> force_quote || opts_out -> force_quote_all ))
699
699
ereport (ERROR ,
700
700
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
701
- errmsg ("COPY force quote available only in CSV mode" )));
701
+ errmsg ("COPY FORCE_QUOTE requires CSV mode" )));
702
702
if ((opts_out -> force_quote || opts_out -> force_quote_all ) && is_from )
703
703
ereport (ERROR ,
704
704
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
705
- errmsg ("COPY force quote only available using COPY TO " )));
705
+ errmsg ("COPY FORCE_QUOTE cannot be used with COPY FROM " )));
706
706
707
707
/* Check force_notnull */
708
708
if (!opts_out -> csv_mode && opts_out -> force_notnull != NIL )
709
709
ereport (ERROR ,
710
710
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
711
- errmsg ("COPY force not null available only in CSV mode" )));
711
+ errmsg ("COPY FORCE_NOT_NULL requires CSV mode" )));
712
712
if (opts_out -> force_notnull != NIL && !is_from )
713
713
ereport (ERROR ,
714
- (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
715
- errmsg ("COPY force not null only available using COPY FROM " )));
714
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
715
+ errmsg ("COPY FORCE_NOT_NULL cannot be used with COPY TO " )));
716
716
717
717
/* Check force_null */
718
718
if (!opts_out -> csv_mode && opts_out -> force_null != NIL )
719
719
ereport (ERROR ,
720
720
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
721
- errmsg ("COPY force null available only in CSV mode" )));
721
+ errmsg ("COPY FORCE_NULL requires CSV mode" )));
722
722
723
723
if (opts_out -> force_null != NIL && !is_from )
724
724
ereport (ERROR ,
725
- (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
726
- errmsg ("COPY force null only available using COPY FROM " )));
725
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
726
+ errmsg ("COPY FORCE_NULL cannot be used with COPY TO " )));
727
727
728
728
/* Don't allow the delimiter to appear in the null string. */
729
729
if (strchr (opts_out -> null_print , opts_out -> delim [0 ]) != NULL )
730
730
ereport (ERROR ,
731
- (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
732
- errmsg ("COPY delimiter must not appear in the NULL specification" )));
731
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
732
+ errmsg ("COPY delimiter character must not appear in the NULL specification" )));
733
733
734
734
/* Don't allow the CSV quote char to appear in the null string. */
735
735
if (opts_out -> csv_mode &&
736
736
strchr (opts_out -> null_print , opts_out -> quote [0 ]) != NULL )
737
737
ereport (ERROR ,
738
- (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
738
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
739
739
errmsg ("CSV quote character must not appear in the NULL specification" )));
740
740
741
+ /* Check freeze */
742
+ if (opts_out -> freeze && !is_from )
743
+ ereport (ERROR ,
744
+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
745
+ errmsg ("COPY FREEZE cannot be used with COPY TO" )));
746
+
741
747
if (opts_out -> default_print )
742
748
{
743
749
if (!is_from )
0 commit comments