mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-20 11:48:31 -06:00
Fix SQL issue of length and precision when changing the data type of Column. Fixes #4698
This commit is contained in:
parent
110a51c5b2
commit
426d9d5872
@ -55,6 +55,7 @@ Bug fixes
|
||||
| `Issue #4663 <https://redmine.postgresql.org/issues/4663>`_ - Fix exception in query history for python 2.7.
|
||||
| `Issue #4674 <https://redmine.postgresql.org/issues/4674>`_ - Fix query tool launch error if user name contain html characters.
|
||||
| `Issue #4681 <https://redmine.postgresql.org/issues/4681>`_ - Increase cache control max age for static files to improve performance over longer run.
|
||||
| `Issue #4698 <https://redmine.postgresql.org/issues/4698>`_ - Fix SQL issue of length and precision when changing the data type of Column.
|
||||
| `Issue #4702 <https://redmine.postgresql.org/issues/4702>`_ - Fix modified SQL for Index when reset the value of Fill factor and Clustered?.
|
||||
| `Issue #4703 <https://redmine.postgresql.org/issues/4703>`_ - Fix reversed engineered SQL for btree Index when provided sort order and NULLs.
|
||||
| `Issue #4726 <https://redmine.postgresql.org/issues/4726>`_ - Ensure sequence with negative value should be created.
|
||||
|
@ -524,10 +524,20 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
Returns:
|
||||
Converted data
|
||||
"""
|
||||
if 'attlen' in data and data['attlen'] is not None:
|
||||
|
||||
# We need to handle the below case because jquery has changed
|
||||
# undefined/null values to empty strings
|
||||
# https://github.com/jquery/jquery/commit/36d2d9ae937f626d98319ed850905e8d1cbfd078
|
||||
if 'attlen' in data and data['attlen'] == '':
|
||||
data['attlen'] = None
|
||||
elif 'attlen' in data and data['attlen'] is not None:
|
||||
data['attlen'] = str(data['attlen'])
|
||||
if 'attprecision' in data and data['attprecision'] is not None:
|
||||
|
||||
if 'attprecision' in data and data['attprecision'] == '':
|
||||
data['attprecision'] = None
|
||||
elif 'attprecision' in data and data['attprecision'] is not None:
|
||||
data['attprecision'] = str(data['attprecision'])
|
||||
|
||||
return data
|
||||
|
||||
@check_precondition
|
||||
@ -791,6 +801,18 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
old_data['cltype'] = self._cltype_formatter(old_data['cltype'])
|
||||
old_data['hasSqrBracket'] = self.hasSqrBracket
|
||||
|
||||
if 'cltype' in data and data['cltype'] != old_data['cltype']:
|
||||
length, precision, typeval = \
|
||||
self.get_length_precision(data['cltype'])
|
||||
|
||||
# if new datatype does not have length or precision
|
||||
# then we cannot apply length or precision of old
|
||||
# datatype to new one.
|
||||
if not length:
|
||||
old_data['attlen'] = -1
|
||||
if not precision:
|
||||
old_data['attprecision'] = None
|
||||
|
||||
# If name is not present in data then
|
||||
# we will fetch it from old data, we also need schema & table name
|
||||
if 'name' not in data:
|
||||
|
Loading…
Reference in New Issue
Block a user