@@ -397,7 +397,9 @@ defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from)
397
397
if (!is_from )
398
398
ereport (ERROR ,
399
399
(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" ),
401
403
parser_errposition (pstate , def -> location )));
402
404
403
405
/*
@@ -410,7 +412,8 @@ defGetCopyOnErrorChoice(DefElem *def, ParseState *pstate, bool is_from)
410
412
411
413
ereport (ERROR ,
412
414
(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 ),
414
417
parser_errposition (pstate , def -> location )));
415
418
return COPY_ON_ERROR_STOP ; /* keep compiler quiet */
416
419
}
@@ -434,7 +437,8 @@ defGetCopyLogVerbosityChoice(DefElem *def, ParseState *pstate)
434
437
435
438
ereport (ERROR ,
436
439
(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 ),
438
442
parser_errposition (pstate , def -> location )));
439
443
return COPY_LOG_VERBOSITY_DEFAULT ; /* keep compiler quiet */
440
444
}
@@ -647,17 +651,18 @@ ProcessCopyOptions(ParseState *pstate,
647
651
if (opts_out -> binary && opts_out -> delim )
648
652
ereport (ERROR ,
649
653
(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" )));
651
656
652
657
if (opts_out -> binary && opts_out -> null_print )
653
658
ereport (ERROR ,
654
659
(errcode (ERRCODE_SYNTAX_ERROR ),
655
- errmsg ("cannot specify NULL in BINARY mode" )));
660
+ errmsg ("cannot specify %s in BINARY mode" , "NULL " )));
656
661
657
662
if (opts_out -> binary && opts_out -> default_print )
658
663
ereport (ERROR ,
659
664
(errcode (ERRCODE_SYNTAX_ERROR ),
660
- errmsg ("cannot specify DEFAULT in BINARY mode" )));
665
+ errmsg ("cannot specify %s in BINARY mode" , "DEFAULT " )));
661
666
662
667
if (opts_out -> binary && opts_out -> on_error != COPY_ON_ERROR_STOP )
663
668
ereport (ERROR ,
@@ -731,13 +736,15 @@ ProcessCopyOptions(ParseState *pstate,
731
736
if (opts_out -> binary && opts_out -> header_line )
732
737
ereport (ERROR ,
733
738
(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" )));
735
741
736
742
/* Check quote */
737
743
if (!opts_out -> csv_mode && opts_out -> quote != NULL )
738
744
ereport (ERROR ,
739
745
(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" )));
741
748
742
749
if (opts_out -> csv_mode && strlen (opts_out -> quote ) != 1 )
743
750
ereport (ERROR ,
@@ -753,7 +760,8 @@ ProcessCopyOptions(ParseState *pstate,
753
760
if (!opts_out -> csv_mode && opts_out -> escape != NULL )
754
761
ereport (ERROR ,
755
762
(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" )));
757
765
758
766
if (opts_out -> csv_mode && strlen (opts_out -> escape ) != 1 )
759
767
ereport (ERROR ,
@@ -764,71 +772,97 @@ ProcessCopyOptions(ParseState *pstate,
764
772
if (!opts_out -> csv_mode && (opts_out -> force_quote || opts_out -> force_quote_all ))
765
773
ereport (ERROR ,
766
774
(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" )));
768
777
if ((opts_out -> force_quote || opts_out -> force_quote_all ) && is_from )
769
778
ereport (ERROR ,
770
779
(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" )));
772
784
773
785
/* Check force_notnull */
774
786
if (!opts_out -> csv_mode && opts_out -> force_notnull != NIL )
775
787
ereport (ERROR ,
776
788
(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" )));
778
791
if (opts_out -> force_notnull != NIL && !is_from )
779
792
ereport (ERROR ,
780
793
(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" )));
782
798
783
799
/* Check force_null */
784
800
if (!opts_out -> csv_mode && opts_out -> force_null != NIL )
785
801
ereport (ERROR ,
786
802
(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" )));
788
805
789
806
if (opts_out -> force_null != NIL && !is_from )
790
807
ereport (ERROR ,
791
808
(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" )));
793
813
794
814
/* Don't allow the delimiter to appear in the null string. */
795
815
if (strchr (opts_out -> null_print , opts_out -> delim [0 ]) != NULL )
796
816
ereport (ERROR ,
797
817
(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" )));
799
821
800
822
/* Don't allow the CSV quote char to appear in the null string. */
801
823
if (opts_out -> csv_mode &&
802
824
strchr (opts_out -> null_print , opts_out -> quote [0 ]) != NULL )
803
825
ereport (ERROR ,
804
826
(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" )));
806
830
807
831
/* Check freeze */
808
832
if (opts_out -> freeze && !is_from )
809
833
ereport (ERROR ,
810
834
(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" )));
812
839
813
840
if (opts_out -> default_print )
814
841
{
815
842
if (!is_from )
816
843
ereport (ERROR ,
817
844
(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" )));
819
849
820
850
/* Don't allow the delimiter to appear in the default string. */
821
851
if (strchr (opts_out -> default_print , opts_out -> delim [0 ]) != NULL )
822
852
ereport (ERROR ,
823
853
(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" )));
825
857
826
858
/* Don't allow the CSV quote char to appear in the default string. */
827
859
if (opts_out -> csv_mode &&
828
860
strchr (opts_out -> default_print , opts_out -> quote [0 ]) != NULL )
829
861
ereport (ERROR ,
830
862
(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" )));
832
866
833
867
/* Don't allow the NULL and DEFAULT string to be the same */
834
868
if (opts_out -> null_print_len == opts_out -> default_print_len &&
0 commit comments