diff --git a/web/pgadmin/misc/sql/static/js/sql.js b/web/pgadmin/misc/sql/static/js/sql.js index 2a5a92309..43abeef60 100644 --- a/web/pgadmin/misc/sql/static/js/sql.js +++ b/web/pgadmin/misc/sql/static/js/sql.js @@ -45,14 +45,16 @@ function(_, $, pgBrowser) { sql = '-- No SQL generated for the selected object.'; if (node.hasSQL) { - sql = '-- Please wait while we fetch the SQL from the server.'; + sql = ''; var url = node.generate_url(item, 'sql', data, true); $.ajax({ url: url, type:'GET', success: function(res) { - pgAdmin.Browser.editor.setValue(res); + if (pgAdmin.Browser.editor.getValue() != res) { + pgAdmin.Browser.editor.setValue(res); + } }, error: function() { // TODO:: Report this @@ -60,7 +62,9 @@ function(_, $, pgBrowser) { }); } } - pgAdmin.Browser.editor.setValue(sql); + if (sql != '') { + pgAdmin.Browser.editor.setValue(sql); + } }, 400); }, sqlPanelVisibilityChanged: function(panel) {