bug_fix_for_ev_command_v2.patch

text/x-diff

Filename: bug_fix_for_ev_command_v2.patch
Type: text/x-diff
Part: 0
Message: Re: Bug fix for psql's meta-command \ev

Patch

Format: unified
Series: patch v2
File+
src/bin/psql/command.c 7 0
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c
index bcd8eb3538..c5f7331ecb 100644
--- a/src/bin/psql/command.c
+++ b/src/bin/psql/command.c
@@ -1239,6 +1239,13 @@ exec_command_ef_ev(PsqlScanState scan_state, bool active_branch,
 				status = PSQL_CMD_NEWEDIT;
 		}
 
+		/*
+		 * On error while doing object lookup or while editing, reset the
+		 * query buffer.
+		 */
+		if (status == PSQL_CMD_ERROR)
+			resetPQExpBuffer(query_buf);
+
 		free(obj_desc);
 	}
 	else