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,7 +805,12 @@ class DatabaseView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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
status, res = self.get_sql(gid, sid, data, did)

View File

@ -555,7 +555,12 @@ class ForeignDataWrapperView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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
try:

View File

@ -578,7 +578,12 @@ class ForeignServerView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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
try:

View File

@ -558,7 +558,12 @@ class LanguageView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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
try:

View File

@ -724,7 +724,12 @@ It may have been removed by another user.
data = dict()
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +602,12 @@ class CollationView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +612,12 @@ class FtsConfigurationView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +607,12 @@ class FtsDictionaryView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +534,12 @@ class FtsParserView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +507,12 @@ class FtsTemplateView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +538,12 @@ class SequenceView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +909,12 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +1041,12 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +1233,12 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings):
res = None
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +495,12 @@ class CheckConstraintView(PGChildNodeView):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +767,12 @@ class CheckConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +558,12 @@ class ExclusionConstraintView(PGChildNodeView):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +793,12 @@ class ExclusionConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +563,12 @@ class ForeignKeyConstraintView(PGChildNodeView):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +832,12 @@ class ForeignKeyConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +576,12 @@ class IndexConstraintView(PGChildNodeView):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +833,12 @@ class IndexConstraintView(PGChildNodeView):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +621,12 @@ class IndexesView(PGChildNodeView):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +831,12 @@ class IndexesView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +619,12 @@ class TriggerView(PGChildNodeView):
for k, v in data.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +832,12 @@ class TriggerView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +647,12 @@ class ViewNode(PGChildNodeView, VacuumSettings):
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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,7 +457,12 @@ class TablespaceView(PGChildNodeView):
data = dict()
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
# 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)
data[k] = v