 pgadmin/frm/frmQuery.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp
index 1ef6417..05f62f6 100644
--- a/pgadmin/frm/frmQuery.cpp
+++ b/pgadmin/frm/frmQuery.cpp
@@ -1785,6 +1785,7 @@ void frmQuery::OpenLastFile()
 	{
 		sqlQuery->SetText(str);
 		sqlQuery->Colourise(0, str.Length());
+		sqlQuery->EmptyUndoBuffer();
 		wxSafeYield();                            // needed to process sqlQuery modify event
 		changed = false;
 		origin = ORIGIN_FILE;
