diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index ea20aa20d413fdd3225fae30551108eeea56aa23..59b596d6f2205c38edf37b4c84c5ef4421994e96 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -524,6 +524,7 @@ exec_command(const char *cmd,
 			puts(query_buf->data);
 		else if (!GetVariableBool(pset->vars, "quiet"))
 			puts("Query buffer is empty.");
+		fflush(stdout);
 	}
 
 	/* \pset -- set printing parameters */