From 97e39699ead1005a4a5ef8e986d980df8f743db9 Mon Sep 17 00:00:00 2001 From: Yosry Muhammad Date: Thu, 1 Aug 2019 14:39:02 +0100 Subject: [PATCH] Ensure the Query Tool doesn't throw an error when viewing the contents of a table with no columns. Fixes #4492 --- docs/en_US/release_notes_4_12.rst | 1 + web/pgadmin/tools/sqleditor/static/js/sqleditor.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/en_US/release_notes_4_12.rst b/docs/en_US/release_notes_4_12.rst index ce9a70f7a..c39cb949d 100644 --- a/docs/en_US/release_notes_4_12.rst +++ b/docs/en_US/release_notes_4_12.rst @@ -23,6 +23,7 @@ Bug fixes | `Issue #4179 `_ - Fix generation of reverse engineered SQL for tables with Greenplum 5.x. | `Issue #4401 `_ - Ensure type names are properly encoded in the results grid. | `Issue #4490 `_ - Fix accessibility issue for checkbox in IE11. +| `Issue #4492 `_ - Ensure the Query Tool doesn't throw an error when viewing the contents of a table with no columns. | `Issue #4496 `_ - Ensure columns can be created when they are IDENTITY fields with the CYCLE option enabled. | `Issue #4497 `_ - Ensure purely numeric comments can be saved on new columns. | `Issue #4508 `_ - Fix accessibility issue for Datetime cell in backgrid. diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js index 5e2d71a6c..5f7fde7c6 100644 --- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js +++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js @@ -2467,8 +2467,8 @@ define('tools.querytool', [ var explain_data_array = [], explain_data_json = null; - - if(self.colinfo[0].name == 'QUERY PLAN' && data.result + if(data.result && !_.isEmpty(self.colinfo) + && self.colinfo[0].name == 'QUERY PLAN' && !_.isEmpty(data.types) && data.types[0] && data.types[0].typname === 'json') { /* json is sent as text, parse it */ explain_data_json = JSON.parse(data.result[0][0]);