Prestashop: SQL Manager allows saving wrong query

Created on 23 May 2019  路  3Comments  路  Source: PrestaShop/PrestaShop

Describe the bug
In Advanced parameters > Database > Sql Manager > Add new SQL query when i add query that is not working, it lets me save it. For example I am able to write random string in query like 'my random query', which doesn't do anything. Later if i want to export it, i get an unexpected error.

To Reproduce
Steps to reproduce the behavior:

  1. Go to Advanced parameters > Database > Sql Manager > Add new SQL query
  2. Fill query name for example 'test'.
  3. Fill query with any string, for example 'my invalid query test'
  4. Save and see that it lets you save the query that is invalid.
  5. Try to export that query by clicking cloud icon in list and see unexpected error (last screenshot)

Screenshots
Screenshot from 2019-05-23 10-02-44
Screenshot from 2019-05-23 10-03-10
Screenshot from 2019-05-23 10-05-11

Additionnal information
PrestaShop version: 1.7.6.x
PHP version: N/A

1.7.5.2 1.7.6.0 BO Bug Database Minor To Do

All 3 comments

In addition, when trying to save wrong query, the exception message should be user-friendly, explaining what is wrong, for example 'Invalid query syntax'. As this is really expected for user to make mistakes.

Hi @zuk3975,

I have the same issue with PS1.7.6.0beta1.
PS: in the PS1.7.5.2, when we click on "Export" or "View" we don't have any exception.
I鈥檒l add this to the debug roadmap.
Thanks!

One important thing to one who will fix this issue. There is also one typo mistake to fix in SqlManagerController IndexAction. Check the screenshot bellow. ( need to change RequestSql:create to SqlManager:create.
Screenshot from 2019-05-23 11-07-45

Was this page helpful?
0 / 5 - 0 ratings