@@ -397,7 +397,9 @@ defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from)
397397 if (!is_from )
398398 ereport (ERROR ,
399399 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
400- errmsg ("COPY ON_ERROR cannot be used with COPY TO" ),
400+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
401+ second %s is a COPY with direction, e.g. COPY TO */
402+ errmsg ("COPY %s cannot be used with %s" , "ON_ERROR" , "COPY TO" ),
401403 parser_errposition (pstate , def -> location )));
402404
403405 /*
@@ -410,7 +412,8 @@ defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from)
410412
411413 ereport (ERROR ,
412414 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
413- errmsg ("COPY ON_ERROR \"%s\" not recognized" , sval ),
415+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR */
416+ errmsg ("COPY %s \"%s\" not recognized" , "ON_ERROR" , sval ),
414417 parser_errposition (pstate , def -> location )));
415418 return COPY_ON_ERROR_STOP ; /* keep compiler quiet */
416419}
@@ -434,7 +437,8 @@ defGetCopyLogVerbosityChoice(DefElem *def, ParseState *pstate)
434437
435438 ereport (ERROR ,
436439 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
437- errmsg ("COPY LOG_VERBOSITY \"%s\" not recognized" , sval ),
440+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR */
441+ errmsg ("COPY %s \"%s\" not recognized" , "LOG_VERBOSITY" , sval ),
438442 parser_errposition (pstate , def -> location )));
439443 return COPY_LOG_VERBOSITY_DEFAULT ; /* keep compiler quiet */
440444}
@@ -647,17 +651,18 @@ ProcessCopyOptions(ParseState *pstate,
647651 if (opts_out -> binary && opts_out -> delim )
648652 ereport (ERROR ,
649653 (errcode (ERRCODE_SYNTAX_ERROR ),
650- errmsg ("cannot specify DELIMITER in BINARY mode" )));
654+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
655+ errmsg ("cannot specify %s in BINARY mode" , "DELIMITER" )));
651656
652657 if (opts_out -> binary && opts_out -> null_print )
653658 ereport (ERROR ,
654659 (errcode (ERRCODE_SYNTAX_ERROR ),
655- errmsg ("cannot specify NULL in BINARY mode" )));
660+ errmsg ("cannot specify %s in BINARY mode" , "NULL " )));
656661
657662 if (opts_out -> binary && opts_out -> default_print )
658663 ereport (ERROR ,
659664 (errcode (ERRCODE_SYNTAX_ERROR ),
660- errmsg ("cannot specify DEFAULT in BINARY mode" )));
665+ errmsg ("cannot specify %s in BINARY mode" , "DEFAULT " )));
661666
662667 if (opts_out -> binary && opts_out -> on_error != COPY_ON_ERROR_STOP )
663668 ereport (ERROR ,
@@ -731,13 +736,15 @@ ProcessCopyOptions(ParseState *pstate,
731736 if (opts_out -> binary && opts_out -> header_line )
732737 ereport (ERROR ,
733738 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
734- errmsg ("cannot specify HEADER in BINARY mode" )));
739+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
740+ errmsg ("cannot specify %s in BINARY mode" , "HEADER" )));
735741
736742 /* Check quote */
737743 if (!opts_out -> csv_mode && opts_out -> quote != NULL )
738744 ereport (ERROR ,
739745 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
740- errmsg ("COPY QUOTE requires CSV mode" )));
746+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
747+ errmsg ("COPY %s requires CSV mode" , "QUOTE" )));
741748
742749 if (opts_out -> csv_mode && strlen (opts_out -> quote ) != 1 )
743750 ereport (ERROR ,
@@ -753,7 +760,8 @@ ProcessCopyOptions(ParseState *pstate,
753760 if (!opts_out -> csv_mode && opts_out -> escape != NULL )
754761 ereport (ERROR ,
755762 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
756- errmsg ("COPY ESCAPE requires CSV mode" )));
763+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
764+ errmsg ("COPY %s requires CSV mode" , "ESCAPE" )));
757765
758766 if (opts_out -> csv_mode && strlen (opts_out -> escape ) != 1 )
759767 ereport (ERROR ,
@@ -764,71 +772,97 @@ ProcessCopyOptions(ParseState *pstate,
764772 if (!opts_out -> csv_mode && (opts_out -> force_quote || opts_out -> force_quote_all ))
765773 ereport (ERROR ,
766774 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
767- errmsg ("COPY FORCE_QUOTE requires CSV mode" )));
775+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
776+ errmsg ("COPY %s requires CSV mode" , "FORCE_QUOTE" )));
768777 if ((opts_out -> force_quote || opts_out -> force_quote_all ) && is_from )
769778 ereport (ERROR ,
770779 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
771- errmsg ("COPY FORCE_QUOTE cannot be used with COPY FROM" )));
780+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
781+ second %s is a COPY with direction, e.g. COPY TO */
782+ errmsg ("COPY %s cannot be used with %s" , "FORCE_QUOTE" ,
783+ "COPY FROM" )));
772784
773785 /* Check force_notnull */
774786 if (!opts_out -> csv_mode && opts_out -> force_notnull != NIL )
775787 ereport (ERROR ,
776788 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
777- errmsg ("COPY FORCE_NOT_NULL requires CSV mode" )));
789+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
790+ errmsg ("COPY %s requires CSV mode" , "FORCE_NOT_NULL" )));
778791 if (opts_out -> force_notnull != NIL && !is_from )
779792 ereport (ERROR ,
780793 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
781- errmsg ("COPY FORCE_NOT_NULL cannot be used with COPY TO" )));
794+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
795+ second %s is a COPY with direction, e.g. COPY TO */
796+ errmsg ("COPY %s cannot be used with %s" , "FORCE_NOT_NULL" ,
797+ "COPY TO" )));
782798
783799 /* Check force_null */
784800 if (!opts_out -> csv_mode && opts_out -> force_null != NIL )
785801 ereport (ERROR ,
786802 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
787- errmsg ("COPY FORCE_NULL requires CSV mode" )));
803+ /*- translator: %s is the name of a COPY option, e.g. ON_ERROR */
804+ errmsg ("COPY %s requires CSV mode" , "FORCE_NULL" )));
788805
789806 if (opts_out -> force_null != NIL && !is_from )
790807 ereport (ERROR ,
791808 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
792- errmsg ("COPY FORCE_NULL cannot be used with COPY TO" )));
809+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
810+ second %s is a COPY with direction, e.g. COPY TO */
811+ errmsg ("COPY %s cannot be used with %s" , "FORCE_NULL" ,
812+ "COPY TO" )));
793813
794814 /* Don't allow the delimiter to appear in the null string. */
795815 if (strchr (opts_out -> null_print , opts_out -> delim [0 ]) != NULL )
796816 ereport (ERROR ,
797817 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
798- errmsg ("COPY delimiter character must not appear in the NULL specification" )));
818+ /*- translator: %s is the name of a COPY option, e.g. NULL */
819+ errmsg ("COPY delimiter character must not appear in the %s specification" ,
820+ "NULL" )));
799821
800822 /* Don't allow the CSV quote char to appear in the null string. */
801823 if (opts_out -> csv_mode &&
802824 strchr (opts_out -> null_print , opts_out -> quote [0 ]) != NULL )
803825 ereport (ERROR ,
804826 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
805- errmsg ("CSV quote character must not appear in the NULL specification" )));
827+ /*- translator: %s is the name of a COPY option, e.g. NULL */
828+ errmsg ("CSV quote character must not appear in the %s specification" ,
829+ "NULL" )));
806830
807831 /* Check freeze */
808832 if (opts_out -> freeze && !is_from )
809833 ereport (ERROR ,
810834 (errcode (ERRCODE_INVALID_PARAMETER_VALUE ),
811- errmsg ("COPY FREEZE cannot be used with COPY TO" )));
835+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
836+ second %s is a COPY with direction, e.g. COPY TO */
837+ errmsg ("COPY %s cannot be used with %s" , "FREEZE" ,
838+ "COPY TO" )));
812839
813840 if (opts_out -> default_print )
814841 {
815842 if (!is_from )
816843 ereport (ERROR ,
817844 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
818- errmsg ("COPY DEFAULT only available using COPY FROM" )));
845+ /*- translator: first %s is the name of a COPY option, e.g. ON_ERROR,
846+ second %s is a COPY with direction, e.g. COPY TO */
847+ errmsg ("COPY %s cannot be used with %s" , "DEFAULT" ,
848+ "COPY TO" )));
819849
820850 /* Don't allow the delimiter to appear in the default string. */
821851 if (strchr (opts_out -> default_print , opts_out -> delim [0 ]) != NULL )
822852 ereport (ERROR ,
823853 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
824- errmsg ("COPY delimiter must not appear in the DEFAULT specification" )));
854+ /*- translator: %s is the name of a COPY option, e.g. NULL */
855+ errmsg ("COPY delimiter character must not appear in the %s specification" ,
856+ "DEFAULT" )));
825857
826858 /* Don't allow the CSV quote char to appear in the default string. */
827859 if (opts_out -> csv_mode &&
828860 strchr (opts_out -> default_print , opts_out -> quote [0 ]) != NULL )
829861 ereport (ERROR ,
830862 (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
831- errmsg ("CSV quote character must not appear in the DEFAULT specification" )));
863+ /*- translator: %s is the name of a COPY option, e.g. NULL */
864+ errmsg ("CSV quote character must not appear in the %s specification" ,
865+ "DEFAULT" )));
832866
833867 /* Don't allow the NULL and DEFAULT string to be the same */
834868 if (opts_out -> null_print_len == opts_out -> default_print_len &&
0 commit comments