diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py index df9eb1a..f6fa65e 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/__init__.py @@ -657,19 +657,23 @@ class TableView(PGChildNodeView, DataTypeReader, VacuumSettings): if 'elemoid' in column: length, precision, typeval = self.get_length_precision(column['elemoid']) + # Set length and precision to None + column['attlen'] = None + column['attprecision'] = None + # If we have length & precision both if length and precision: matchObj = re.search(r'(\d+),(\d+)', fulltype) - column['attlen'] = matchObj.group(1) - column['attprecision'] = matchObj.group(2) + if matchObj: + column['attlen'] = matchObj.group(1) + column['attprecision'] = matchObj.group(2) elif length: # If we have length only matchObj = re.search(r'(\d+)', fulltype) - column['attlen'] = matchObj.group(1) - column['attprecision'] = None - else: - column['attlen'] = None - column['attprecision'] = None + if matchObj: + column['attlen'] = matchObj.group(1) + column['attprecision'] = None + SQL = render_template("/".join([self.column_template_path, 'is_referenced.sql']), diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py index 7a28cda..b5b88e9 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/tables/column/__init__.py @@ -348,21 +348,24 @@ class ColumnsView(PGChildNodeView, DataTypeReader): if 'elemoid' in data: length, precision, typeval = self.get_length_precision(data['elemoid']) + # Set length and precision to None + data['attlen'] = None + data['attprecision'] = None + import re - # If we have length & precision both + # If we have length & precision both if length and precision: matchObj = re.search(r'(\d+),(\d+)', fulltype) - data['attlen'] = matchObj.group(1) - data['attprecision'] = matchObj.group(2) + if matchObj: + data['attlen'] = matchObj.group(1) + data['attprecision'] = matchObj.group(2) elif length: # If we have length only matchObj = re.search(r'(\d+)', fulltype) - data['attlen'] = matchObj.group(1) - data['attprecision'] = None - else: - data['attlen'] = None - data['attprecision'] = None + if matchObj: + data['attlen'] = matchObj.group(1) + data['attprecision'] = None # We need to fetch inherited tables for each table SQL = render_template("/".join([self.template_path, diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py index 8f02741..07df594 100644 --- a/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py +++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/types/__init__.py @@ -435,19 +435,22 @@ class TypeView(PGChildNodeView, DataTypeReader): # Below logic will allow us to split length, precision from type name for grid import re + t_len = None + t_prec = None + # If we have length & precision both if is_tlength and is_precision: matchObj = re.search(r'(\d+),(\d+)', row['fulltype']) - t_len = matchObj.group(1) - t_prec = matchObj.group(2) + if matchObj: + t_len = matchObj.group(1) + t_prec = matchObj.group(2) elif is_tlength: # If we have length only matchObj = re.search(r'(\d+)', row['fulltype']) - t_len = matchObj.group(1) - t_prec = None - else: - t_len = None - t_prec = None + if matchObj: + t_len = matchObj.group(1) + t_prec = None + type_name = DataTypeReader.parse_type_name(row['typname'])