diff --git a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
index 74502c7..8f33459 100644
--- a/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/templates/sqleditor/js/sqleditor.js
@@ -1593,10 +1593,17 @@ define(
                 $("#btn-file-menu-dropdown").prop('disabled', true);
                 $("#btn-copy-row").prop('disabled', true);
                 $("#btn-paste-row").prop('disabled', true);
+                $("#btn-download").prop('disabled', false);

                 // Set the combo box value
                 $(".limit").val(res.data.limit);

+                var editor_query = self.query;
+                if (editor_query && _.isNull(editor_query.toLowerCase().
+                    match('^select'))) {
+                  $("#btn-download").prop('disabled', true);
+                }
+
                 // If status is True then poll the result.
                 self._poll();
               }
@@ -2963,6 +2970,15 @@ define(
           self.disable_tool_buttons(true);
           $("#btn-cancel-query").prop('disabled', false);

+          var editor_query = sql;
+          if (editor_query && _.isNull(editor_query.toLowerCase().
+              match('^select'))) {
+            $("#btn-download").prop('disabled', true);
+          }
+          else {
+            $("#btn-download").prop('disabled', false);
+          }
+
           $.ajax({
             url: "{{ url_for('sqleditor.index') }}" + "query_tool/start/" + self.transId,
             method: 'POST',
