summaryrefslogtreecommitdiff
path: root/src/bin/psql/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/psql/command.c')
-rw-r--r--src/bin/psql/command.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index b981ae81ffa..7f57da8cc50 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -3508,7 +3508,8 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf,
{
unsigned int ql = query_buf->len;
- if (ql == 0 || query_buf->data[ql - 1] != '\n')
+ /* force newline-termination of what we send to editor */
+ if (ql > 0 && query_buf->data[ql - 1] != '\n')
{
appendPQExpBufferChar(query_buf, '\n');
ql++;