1) Ensure that JSON strings as comments should be added properly for all the objects. Fixes #3582

2) Fixed alignment issue of columns in definition section of Index node. Fixes #4121
This commit is contained in:
Aditya Toshniwal 2019-04-12 15:07:07 +05:30 committed by Akshay Joshi
parent a25bb2b7db
commit 024cfd2fab
22 changed files with 171 additions and 28 deletions

View File

@ -15,7 +15,9 @@ Features
Bug fixes
*********
| `Bug #3582 <https://redmine.postgresql.org/issues/3582>`_ - Ensure that JSON strings as comments should be added properly for all the objects.
| `Bug #3938 <https://redmine.postgresql.org/issues/3938>`_ - Added support for Default Partition.
| `Bug #4104 <https://redmine.postgresql.org/issues/4104>`_ - Ensure that record should be add/edited for root partition table with primary keys.
| `Bug #4121 <https://redmine.postgresql.org/issues/4121>`_ - Fixed alignment issue of columns in definition section of Index node.
| `Bug #4138 <https://redmine.postgresql.org/issues/4138>`_ - Fix an issue where the dropdown becomes misaligned/displaced.
| `Bug #4161 <https://redmine.postgresql.org/issues/4161>`_ - Ensure that parameters of procedures for EPAS server 10 and below should be set/reset properly.

View File

@ -805,6 +805,11 @@ class DatabaseView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comments',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -555,6 +555,11 @@ class ForeignDataWrapperView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -578,6 +578,11 @@ class ForeignServerView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -558,6 +558,11 @@ class LanguageView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -724,6 +724,11 @@ It may have been removed by another user.
data = dict()
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -602,6 +602,11 @@ class CollationView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -612,6 +612,11 @@ class FtsConfigurationView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -607,6 +607,11 @@ class FtsDictionaryView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -534,6 +534,11 @@ class FtsParserView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -507,6 +507,11 @@ class FtsTemplateView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -538,6 +538,11 @@ class SequenceView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -909,6 +909,11 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -1036,6 +1041,11 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -1223,6 +1233,11 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings):
res = None
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v

View File

@ -495,6 +495,11 @@ class CheckConstraintView(PGChildNodeView):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -762,6 +767,11 @@ class CheckConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -558,6 +558,11 @@ class ExclusionConstraintView(PGChildNodeView):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -788,6 +793,11 @@ class ExclusionConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -563,6 +563,11 @@ class ForeignKeyConstraintView(PGChildNodeView):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -827,6 +832,11 @@ class ForeignKeyConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -576,6 +576,11 @@ class IndexConstraintView(PGChildNodeView):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -828,6 +833,11 @@ class IndexConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -621,6 +621,11 @@ class IndexesView(PGChildNodeView):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -826,6 +831,11 @@ class IndexesView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -230,6 +230,7 @@ define('pgadmin.node.index', [
hasSQL: true,
hasDepends: true,
hasStatistics: true,
width: pgBrowser.stdW.md + 'px',
statsPrettifyFields: [gettext('Size'), gettext('Index size')],
Init: function() {
/* Avoid mulitple registration of menus */

View File

@ -619,6 +619,11 @@ class TriggerView(PGChildNodeView):
for k, v in data.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except (ValueError, TypeError, KeyError):
data[k] = v
@ -827,6 +832,11 @@ class TriggerView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -647,6 +647,11 @@ class ViewNode(PGChildNodeView, VacuumSettings):
data = {}
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('comment',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v

View File

@ -457,6 +457,11 @@ class TablespaceView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
# comments should be taken as is because if user enters a
# json comment it is parsed by loads which should not happen
if k in ('description',):
data[k] = v
else:
data[k] = json.loads(v, encoding='utf-8')
except ValueError as ve:
current_app.logger.exception(ve)