From c0c9034326565e95598f0b1219be4e35354af0bf Mon Sep 17 00:00:00 2001 From: Khushboo Vashi Date: Wed, 17 May 2023 12:10:43 +0530 Subject: [PATCH] Fix an issue where varchar column sizes are not visible in query tool data grid. #6281 --- web/pgadmin/tools/sqleditor/__init__.py | 1 + .../sqleditor/static/js/components/sections/ResultSet.jsx | 4 ++-- web/pgadmin/tools/sqleditor/utils/get_column_types.py | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/web/pgadmin/tools/sqleditor/__init__.py b/web/pgadmin/tools/sqleditor/__init__.py index fbe3ef42b..85216a81c 100644 --- a/web/pgadmin/tools/sqleditor/__init__.py +++ b/web/pgadmin/tools/sqleditor/__init__.py @@ -961,6 +961,7 @@ def poll(trans_id): col_type['type_code'] = col['type_code'] col_type['type_name'] = None col_type['internal_size'] = col['internal_size'] + col_type['display_size'] = col['display_size'] columns[col['name']] = col_type if columns: diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx index ec0e90193..83fef41e7 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/ResultSet.jsx @@ -492,9 +492,9 @@ export class ResultSetUtils { case '"char"[]': case 'character varying': case 'character varying[]': - if (c.internal_size && c.internal_size >= 0 && c.internal_size != 65535) { + if (c.display_size && c.display_size >= 0 && c.display_size != 65535) { // Update column type to display length on column header - columnType += ' (' + c.internal_size + ')'; + columnType += ' (' + c.display_size + ')'; } cellType = 'string'; break; diff --git a/web/pgadmin/tools/sqleditor/utils/get_column_types.py b/web/pgadmin/tools/sqleditor/utils/get_column_types.py index 741ccf2b1..9c40c9fa1 100644 --- a/web/pgadmin/tools/sqleditor/utils/get_column_types.py +++ b/web/pgadmin/tools/sqleditor/utils/get_column_types.py @@ -39,6 +39,7 @@ def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids): col_type['type_code'] = col['type_code'] col_type['type_name'] = None col_type['internal_size'] = col['internal_size'] + col_type['display_size'] = col['display_size'] column_types[col['name']] = col_type if not is_query_tool: