@@ -671,7 +671,7 @@ ProcessCopyOptions(ParseState *pstate,
671671 if (!opts_out -> csv_mode && opts_out -> quote != NULL )
672672 ereport (ERROR ,
673673 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
674- errmsg ("COPY quote available only in CSV mode" )));
674+ errmsg ("COPY QUOTE requires CSV mode" )));
675675
676676 if (opts_out -> csv_mode && strlen (opts_out -> quote ) != 1 )
677677 ereport (ERROR ,
@@ -687,7 +687,7 @@ ProcessCopyOptions(ParseState *pstate,
687687 if (!opts_out -> csv_mode && opts_out -> escape != NULL )
688688 ereport (ERROR ,
689689 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
690- errmsg ("COPY escape available only in CSV mode" )));
690+ errmsg ("COPY ESCAPE requires CSV mode" )));
691691
692692 if (opts_out -> csv_mode && strlen (opts_out -> escape ) != 1 )
693693 ereport (ERROR ,
@@ -698,46 +698,52 @@ ProcessCopyOptions(ParseState *pstate,
698698 if (!opts_out -> csv_mode && (opts_out -> force_quote || opts_out -> force_quote_all ))
699699 ereport (ERROR ,
700700 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
701- errmsg ("COPY force quote available only in CSV mode" )));
701+ errmsg ("COPY FORCE_QUOTE requires CSV mode" )));
702702 if ((opts_out -> force_quote || opts_out -> force_quote_all ) && is_from )
703703 ereport (ERROR ,
704704 (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 " )));
706706
707707 /* Check force_notnull */
708708 if (!opts_out -> csv_mode && opts_out -> force_notnull != NIL )
709709 ereport (ERROR ,
710710 (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" )));
712712 if (opts_out -> force_notnull != NIL && !is_from )
713713 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 " )));
716716
717717 /* Check force_null */
718718 if (!opts_out -> csv_mode && opts_out -> force_null != NIL )
719719 ereport (ERROR ,
720720 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
721- errmsg ("COPY force null available only in CSV mode" )));
721+ errmsg ("COPY FORCE_NULL requires CSV mode" )));
722722
723723 if (opts_out -> force_null != NIL && !is_from )
724724 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 " )));
727727
728728 /* Don't allow the delimiter to appear in the null string. */
729729 if (strchr (opts_out -> null_print , opts_out -> delim [0 ]) != NULL )
730730 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" )));
733733
734734 /* Don't allow the CSV quote char to appear in the null string. */
735735 if (opts_out -> csv_mode &&
736736 strchr (opts_out -> null_print , opts_out -> quote [0 ]) != NULL )
737737 ereport (ERROR ,
738- (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
738+ (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
739739 errmsg ("CSV quote character must not appear in the NULL specification" )));
740740
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+
741747 if (opts_out -> default_print )
742748 {
743749 if (!is_from )
0 commit comments