Skip to content

Commit 7a88ff3

Browse files
Fixed an issue where an error was displayed when a table was dropped while a query was running. #6564
1 parent 82efd18 commit 7a88ff3

1 file changed

Lines changed: 21 additions & 20 deletions

File tree

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

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,32 @@ 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'] = row['not_null']
7071

71-
col_type['has_default_val'] = \
72-
col['has_default_val'] = row['has_default_val']
72+
col_type['has_default_val'] = \
73+
col['has_default_val'] = row['has_default_val']
7374

74-
col_type['seqtypid'] = col['seqtypid'] = row['seqtypid']
75-
break
75+
col_type['seqtypid'] = col['seqtypid'] = row['seqtypid']
76+
break
7677

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
78+
else:
79+
col_type['not_null'] = col['not_null'] = None
80+
col_type['has_default_val'] = col['has_default_val'] = None
81+
col_type['seqtypid'] = col['seqtypid'] = None
8182

8283
return column_types

0 commit comments

Comments
 (0)