Ensure View Data on a table with zero columns doesn't throw an error. Fixes #1677

pull/3/head
Murtuza Zabuawala 2016-09-14 10:43:08 +01:00 committed by Dave Page
parent 046f6dd442
commit 751327eacc
2 changed files with 22 additions and 15 deletions

View File

@ -531,25 +531,28 @@ def fetch_pg_types(trans_id):
# List of oid for which we need type name from pg_type
oid = ''
for col in session_obj['columns_info']:
type_obj = session_obj['columns_info'][col]
oid += str(type_obj['type_code']) + ','
res = {}
if 'columns_info' in session_obj \
and session_obj['columns_info'] is not None:
for col in session_obj['columns_info']:
type_obj = session_obj['columns_info'][col]
oid += str(type_obj['type_code']) + ','
# Remove extra comma
oid = oid[:-1]
status, res = conn.execute_dict(
"""SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN ({0}) ORDER BY oid;
# Remove extra comma
oid = oid[:-1]
status, res = conn.execute_dict(
"""SELECT oid, format_type(oid,null) as typname FROM pg_type WHERE oid IN ({0}) ORDER BY oid;
""".format(oid))
if status:
# iterate through pg_types and update the type name in session object
for record in res['rows']:
for col in session_obj['columns_info']:
type_obj = session_obj['columns_info'][col]
if type_obj['type_code'] == record['oid']:
type_obj['type_name'] = record['typname']
if status:
# iterate through pg_types and update the type name in session object
for record in res['rows']:
for col in session_obj['columns_info']:
type_obj = session_obj['columns_info'][col]
if type_obj['type_code'] == record['oid']:
type_obj['type_name'] = record['typname']
update_session_grid_transaction(trans_id, session_obj)
update_session_grid_transaction(trans_id, session_obj)
else:
status = False
res = error_msg

View File

@ -407,3 +407,7 @@ input.editor-checkbox {
.grid-canvas .new_row.error, .grid-canvas .updated_row.error {
background: #e46b6b;
}
#datagrid div.slick-header.ui-state-default {
background: #2c76b4;
}