Fix the fix for RM2324.

This commit is contained in:
Khushboo Vashi 2017-06-13 09:18:44 +01:00 committed by Dave Page
parent 0243d886c3
commit 16a15bf934
3 changed files with 33 additions and 23 deletions

View File

@ -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']),

View File

@ -348,21 +348,24 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
if 'elemoid' in data:
length, precision, typeval = self.get_length_precision(data['elemoid'])
import re
# If we have length & precision both
# Set length and precision to None
data['attlen'] = None
data['attprecision'] = None
import re
# 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,

View File

@ -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'])