Fixed an issue where the user is not able to insert the data if the table and columns name contains special characters. Fixes #4387

This commit is contained in:
Yogesh Mahajan 2020-08-06 12:30:10 +05:30 committed by Akshay Joshi
parent 6a406f466d
commit e3dfe03a2a
5 changed files with 11 additions and 3 deletions

View File

@ -24,6 +24,7 @@ Bug fixes
*********
| `Issue #3767 <https://redmine.postgresql.org/issues/3767>`_ - Ensure that the original file format should be retained when saving the same file in SQL editor.
| `Issue #4387 <https://redmine.postgresql.org/issues/4387>`_ - Fixed an issue where the user is not able to insert the data if the table and columns name contains special characters.
| `Issue #4810 <https://redmine.postgresql.org/issues/4810>`_ - Fixed an issue where the user is not able to save the new row if the table is empty.
| `Issue #5429 <https://redmine.postgresql.org/issues/5429>`_ - Ensure that the Dictionaries drop-down shows all the dictionaries in the FTS configuration dialog.
| `Issue #5490 <https://redmine.postgresql.org/issues/5490>`_ - Make the runtime configuration dialog non-modal.

View File

@ -786,7 +786,7 @@ define('tools.querytool', [
c.column_type = _.escape(c.column_type);
var options = {
id: c.name,
id: _.escape(c.name),
pos: c.pos,
field: c.name,
name: c.label,

View File

@ -5,5 +5,5 @@ WHERE
oid = %(oid)s
{% elif primary_keys|length > 0 %}
{% for pk in primary_keys %}
{% if not loop.first %} AND {% endif %}{{ conn|qtIdent(pk) }} = %({{ pk }})s{% endfor %}
{% if not loop.first %} AND {% endif %}{{ conn|qtIdent(pk) }} = %({{ pgadmin_alias[pk] }})s{% endfor %}
{% endif %};

View File

@ -54,6 +54,7 @@ class TestViewDataTemplates(BaseTestGenerator):
select_template_path='sqleditor/sql/default/select.sql',
select_parameters=dict(
object_name='test_table',
pgadmin_alias=pgadmin_alias,
nsp_name='test_schema',
primary_keys=OrderedDict([('id', 'int4')]),
has_oids=False
@ -87,6 +88,7 @@ class TestViewDataTemplates(BaseTestGenerator):
select_parameters=dict(
object_name='test_table',
nsp_name='test_schema',
pgadmin_alias=pgadmin_alias,
primary_keys=OrderedDict([('id', 'int4'),
('text', 'text')]),
has_oids=False

View File

@ -138,6 +138,7 @@ def save_changed_data(changed_data, columns_info, conn, command_obj,
"/".join([command_obj.sql_path, 'select.sql']),
object_name=command_obj.object_name,
nsp_name=command_obj.nsp_name,
pgadmin_alias=pgadmin_alias,
primary_keys=primary_keys,
has_oids=command_obj.has_oids()
)
@ -279,8 +280,12 @@ def save_changed_data(changed_data, columns_info, conn, command_obj,
# Select added row from the table
if 'select_sql' in item:
params = {
pgadmin_alias[k] if k in pgadmin_alias else k: v
for k, v in res['rows'][0].items()
}
status, sel_res = conn.execute_dict(
item['select_sql'], res['rows'][0])
item['select_sql'], params)
if not status:
return failure_handle(sel_res, item.get('row_id', 0))