Skip to content

Commit 5d78f4a

Browse files
Fix the issue where an error is displayed when a table is dropped while a query is running. #6564
1 parent 695f870 commit 5d78f4a

1 file changed

Lines changed: 25 additions & 20 deletions

File tree

web/pgadmin/tools/sqleditor/utils/get_column_types.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,36 @@ def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids,
5252
col_type['display_size'] = col['display_size']
5353
column_types[col['name']] = col_type
5454

55-
if not is_query_tool:
56-
col_type['not_null'] = col['not_null'] = \
57-
rset['rows'][key]['not_null']
55+
if rset['rows']:
56+
if not is_query_tool:
57+
col_type['not_null'] = col['not_null'] = \
58+
rset['rows'][key]['not_null']
5859

59-
col_type['has_default_val'] = \
60-
col['has_default_val'] = \
61-
rset['rows'][key]['has_default_val']
60+
col_type['has_default_val'] = \
61+
col['has_default_val'] = \
62+
rset['rows'][key]['has_default_val']
6263

63-
col_type['seqtypid'] = col['seqtypid'] = \
64-
rset['rows'][key]['seqtypid']
64+
col_type['seqtypid'] = col['seqtypid'] = \
65+
rset['rows'][key]['seqtypid']
6566

66-
else:
67-
for row in rset['rows']:
68-
if row['oid'] == col['table_column']:
69-
col_type['not_null'] = col['not_null'] = row['not_null']
67+
else:
68+
for row in rset['rows']:
69+
if row['oid'] == col['table_column']:
70+
col_type['not_null'] = col['not_null'] = \
71+
row['not_null']
7072

71-
col_type['has_default_val'] = \
72-
col['has_default_val'] = row['has_default_val']
73+
col_type['has_default_val'] = \
74+
col['has_default_val'] = \
75+
row['has_default_val']
7376

74-
col_type['seqtypid'] = col['seqtypid'] = row['seqtypid']
75-
break
77+
col_type['seqtypid'] = col['seqtypid'] = \
78+
row['seqtypid']
79+
break
7680

77-
else:
78-
col_type['not_null'] = col['not_null'] = None
79-
col_type['has_default_val'] = col['has_default_val'] = None
80-
col_type['seqtypid'] = col['seqtypid'] = None
81+
else:
82+
col_type['not_null'] = col['not_null'] = None
83+
col_type['has_default_val'] = \
84+
col['has_default_val'] = None
85+
col_type['seqtypid'] = col['seqtypid'] = None
8186

8287
return column_types

0 commit comments

Comments
 (0)