Index: include/frm/frmQuery.h
===================================================================
--- include/frm/frmQuery.h	(revision 7943)
+++ include/frm/frmQuery.h	(working copy)
@@ -197,6 +197,8 @@
     bool aborted;
     bool lastFileFormat;
 
+    static wxMutex ms_exeMutex;
+
     DECLARE_EVENT_TABLE()
 };
 
Index: frm/frmQuery.cpp
===================================================================
--- frm/frmQuery.cpp	(revision 7943)
+++ frm/frmQuery.cpp	(working copy)
@@ -75,6 +75,9 @@
 #define CTRLID_CONNECTION       4200
 #define CTRLID_DATABASELABEL    4201
 
+// Initialize execution mutex
+wxMutex frmQuery::ms_exeMutex;
+
 BEGIN_EVENT_TABLE(frmQuery, pgFrame)
 EVT_ERASE_BACKGROUND(           frmQuery::OnEraseBackground)
 EVT_SIZE(                       frmQuery::OnSize)
@@ -1863,6 +1866,12 @@
     if (query.IsNull())
         return;
 
+    if (ms_exeMutex.TryLock() == wxMUTEX_BUSY)
+    {
+        wxMessageBox(_("Parallel script execution is in process."), _("Can not countinue executing the pgScript!"), wxICON_WARNING);
+        return;
+    }
+
     // Clear markers and indicators
     sqlQuery->MarkerDeleteAll(0);
     sqlQuery->StartStyling(0, wxSTC_INDICS_MASK);
@@ -2235,6 +2244,9 @@
     // Reset tools
     setTools(false);
 
+    // Unlock mutex
+    ms_exeMutex.Unlock();
+
     // Manage timer
     elapsedQuery = wxGetLocalTimeMillis() - startTimeQuery;
     SetStatusText(elapsedQuery.ToString() + wxT(" ms"), STATUSPOS_SECS);
@@ -2317,6 +2329,7 @@
         conn->ExecuteVoid(wxT("ROLLBACK;"));
 
     setTools(false);
+    
     fileMenu->Enable(MNU_EXPORT, sqlResult->CanExport());
 
     if (!IsActive())
