diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons
index 71f7ad26ad..e53929dd84 100644
--- a/src/interfaces/ecpg/preproc/ecpg.addons
+++ b/src/interfaces/ecpg/preproc/ecpg.addons
@@ -240,9 +240,9 @@ ECPG: block where_or_current_clause WHERE CURRENT_P OF cursor_name
                @$ = cat_str(2, "where current of", cursor_marker);
        }
 ECPG: addon CopyStmt COPY opt_binary qualified_name opt_column_list copy_from opt_program copy_file_name copy_delimiter opt_with copy_options where_clause
-               if (strcmp(@6, "from") == 0 &&
+               if (strcmp(@5, "from") == 0 &&
                        (strcmp(@7, "stdin") == 0 || strcmp(@7, "stdout") == 0))
-                       mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN is not implemented");
+                       mmerror(PARSE_ERROR, ET_WARNING, "COPY FROM STDIN/STDOUT is not implemented");
 ECPG: addon var_value NumericOnly
                if (@1[0] == '$')
                        @$ = "$0";
 