diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c
index 6c61167f2c5f2b1ce2f5a0bc0637e5eda371e972..a201c2f57049e3e04a16f9c36ffb18458ad37071 100644
--- a/src/bin/psql/copy.c
+++ b/src/bin/psql/copy.c
@@ -537,7 +537,7 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary)
 	{
 		if (!pset.quiet)
 			puts(_("Enter data to be copied followed by a newline.\n"
-				   "End with a backslash and a period on a line by itself."));
+				   "End with a backslash and a period on a line by itself, or an EOF signal."));
 		prompt = get_prompt(PROMPT_COPY);
 	}
 	else
@@ -658,6 +658,16 @@ handleCopyIn(PGconn *conn, FILE *copystream, bool isbinary)
 
 copyin_cleanup:
 
+	/*
+	 * Clear the EOF flag on the stream, in case copying ended due to an EOF
+	 * signal.  This allows an interactive TTY session to perform another COPY
+	 * FROM STDIN later.  (In non-STDIN cases, we're about to close the file
+	 * anyway, so it doesn't matter.)  Although we don't ever test the flag
+	 * with feof(), some fread() implementations won't read more data if it's
+	 * set.  This also clears the error flag, but we already checked that.
+	 */
+	clearerr(copystream);
+
 	/*
 	 * Check command status and return to normal libpq state.
 	 *