From f4c3d89b4ed7c94b3d2ee640b2788e6ea22e2e15 Mon Sep 17 00:00:00 2001 From: Aravind Shankar Date: Mon, 8 Jul 2019 15:26:13 +0530 Subject: [PATCH] fix sql to return empty array when there are no columns in a table, close #2481 --- console/src/components/Services/Data/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/console/src/components/Services/Data/utils.js b/console/src/components/Services/Data/utils.js index ba16c711142f2..03abeadf83a40 100644 --- a/console/src/components/Services/Data/utils.js +++ b/console/src/components/Services/Data/utils.js @@ -377,7 +377,7 @@ FROM ):: regclass, 'pg_class' ) as comment, - json_agg( + COALESCE(json_agg( row_to_json(isc) :: JSONB || jsonb_build_object( 'comment', ( @@ -399,7 +399,7 @@ FROM AND c.relname = isc.table_name ) ) - ) AS columns, + ) FILTER (WHERE isc.column_name IS NOT NULL), '[]' :: JSON) AS columns, row_to_json(isc_views) as view_info from information_schema.tables AS ist