Bug 28804 - 500 Error when running report with bad syntax
Summary: 500 Error when running report with bad syntax
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords: rel_21_05_candidate
Depends on: 25026
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-03 12:56 UTC by jstallings
Modified: 2021-08-13 19:52 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Text to go in the release notes:
Version(s) released in:
21.11.00,21.05.03


Attachments
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports (4.58 KB, patch)
2021-08-04 07:04 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports (4.63 KB, patch)
2021-08-04 16:58 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports (4.69 KB, patch)
2021-08-10 13:11 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description jstallings 2021-08-03 12:56:57 UTC
In previous versions, running an SQL report with an error (typo, bad syntax) would yield an error page with the problem syntax highlighted. 21.05 returns only a 500 error. Excerpt from plack-intranet-error.log here: https://pastebin.com/0UCYkU46
Comment 1 Jonathan Druart 2021-08-04 07:01:26 UTC
Certainly caused by bug 25026.
Comment 2 Jonathan Druart 2021-08-04 07:04:56 UTC
Created attachment 123446 [details] [review]
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports

Since bug 25026 DBMS errors are raised, but the report module is not
dealing correctly with the errors.
If an error occurred in execute_query, next queries will fail as well,
we should skip them.

Test plan:
1. Create report from SQL queries, containing errors (invalid syntax, etc.)
'SELECT id FROM borrowers' can do it
2. Execute the query
=> Without this patch you get a 500
=> With this patch applied you see that the error raised at DBMS level
is propagated to the UI
3. Confirm that there is no regression on valid queries
Comment 3 Owen Leonard 2021-08-04 16:58:27 UTC
Created attachment 123461 [details] [review]
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports

Since bug 25026 DBMS errors are raised, but the report module is not
dealing correctly with the errors.
If an error occurred in execute_query, next queries will fail as well,
we should skip them.

Test plan:
1. Create report from SQL queries, containing errors (invalid syntax, etc.)
'SELECT id FROM borrowers' can do it
2. Execute the query
=> Without this patch you get a 500
=> With this patch applied you see that the error raised at DBMS level
is propagated to the UI
3. Confirm that there is no regression on valid queries

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 4 Katrin Fischer 2021-08-10 13:11:05 UTC
Created attachment 123686 [details] [review]
Bug 28804: (bug 25026 follow-up) Handle SQL errors in reports

Since bug 25026 DBMS errors are raised, but the report module is not
dealing correctly with the errors.
If an error occurred in execute_query, next queries will fail as well,
we should skip them.

Test plan:
1. Create report from SQL queries, containing errors (invalid syntax, etc.)
'SELECT id FROM borrowers' can do it
2. Execute the query
=> Without this patch you get a 500
=> With this patch applied you see that the error raised at DBMS level
is propagated to the UI
3. Confirm that there is no regression on valid queries

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Jonathan Druart 2021-08-11 11:24:15 UTC
Pushed to master for 21.11, thanks to everybody involved!
Comment 6 Kyle M Hall 2021-08-13 11:29:26 UTC
Pushed to 21.05.x for 21.05.03
Comment 7 Fridolin Somers 2021-08-13 19:52:37 UTC
Depends on Bug 25026 not in 20.11.x