Data should be updated properly for FTS Configurations, FTS Dictionaries, FTS Parsers and FTS Templates. Fixes #3897

This commit is contained in:
Akshay Joshi 2019-01-21 14:36:39 +05:30
parent 27cdb835cb
commit c7cbe0ff4a
5 changed files with 26 additions and 6 deletions

View File

@ -23,4 +23,5 @@ Bug fixes
| `Bug #3837 <https://redmine.postgresql.org/issues/3837>`_ - Fixed SQL for when clause while creating Trigger.
| `Bug #3838 <https://redmine.postgresql.org/issues/3838>`_ - Proper SQL should be generated when creating/changing column with custom type argument.
| `Bug #3846 <https://redmine.postgresql.org/issues/3846>`_ - Proper SQL should be generated when create procedure with custom type arguments.
| `Bug #3891 <https://redmine.postgresql.org/issues/3891>`_ - Correct order of Save and Cancel button for json/jsonb editing.
| `Bug #3891 <https://redmine.postgresql.org/issues/3891>`_ - Correct order of Save and Cancel button for json/jsonb editing.
| `Bug #3897 <https://redmine.postgresql.org/issues/3897>`_ - Data should be updated properly for FTS Configurations, FTS Dictionaries, FTS Parsers and FTS Templates.

View File

@ -509,7 +509,7 @@ class FtsConfigurationView(PGChildNodeView):
sql = render_template(
"/".join([self.template_path, 'nodes.sql']),
cfgid=cfgid,
scid=data['schema'] if 'scheam' in data else scid
scid=data['schema'] if 'schema' in data else scid
)
status, res = self.conn.execute_dict(sql)
@ -655,6 +655,8 @@ class FtsConfigurationView(PGChildNodeView):
return gone(_("Could not find the FTS Configuration node."))
old_data = res['rows'][0]
if 'schema' not in data:
data['schema'] = old_data['schema']
# If user has changed the schema then fetch new schema directly
# using its oid otherwise fetch old schema name using its oid

View File

@ -651,6 +651,8 @@ class FtsDictionaryView(PGChildNodeView):
return gone(_("Could not find the FTS Dictionary node."))
old_data = res['rows'][0]
if 'schema' not in data:
data['schema'] = old_data['schema']
# Handle templates and its schema name properly
if old_data['template_schema'] is not None:

View File

@ -530,8 +530,13 @@ class FtsParserView(PGChildNodeView):
:param scid: schema id
:param pid: fts tempate id
"""
data = request.args
# Fetch sql query for modified data
# data = request.args
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v
# Fetch sql query for modified data
SQL, name = self.get_sql(gid, sid, did, scid, data, pid)
@ -572,6 +577,8 @@ class FtsParserView(PGChildNodeView):
return gone(_("Could not find the FTS Parser node."))
old_data = res['rows'][0]
if 'schema' not in data:
data['schema'] = old_data['schema']
# If user has changed the schema then fetch new schema directly
# using its oid otherwise fetch old schema name with parser oid

View File

@ -502,9 +502,15 @@ class FtsTemplateView(PGChildNodeView):
:param scid: schema id
:param tid: fts tempate id
"""
data = request.args
# Fetch sql query for modified data
# data = request.args
data = {}
for k, v in request.args.items():
try:
data[k] = json.loads(v, encoding='utf-8')
except ValueError:
data[k] = v
# Fetch sql query for modified data
SQL, name = self.get_sql(gid, sid, did, scid, data, tid)
# Most probably this is due to error
@ -546,6 +552,8 @@ class FtsTemplateView(PGChildNodeView):
)
old_data = res['rows'][0]
if 'schema' not in data:
data['schema'] = old_data['schema']
# If user has changed the schema then fetch new schema directly
# using its oid otherwise fetch old schema name using