Bug 19326 - Report editor in guided_reports.pl truncates reports longer than 64 KiB
Summary: Report editor in guided_reports.pl truncates reports longer than 64 KiB
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-15 15:32 UTC by Barton Chittenden
Modified: 2017-09-15 22:32 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
A query longer than 65535; this will be truncated when saved. (67.67 KB, application/sql)
2017-09-15 15:32 UTC, Barton Chittenden
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2017-09-15 15:32:11 UTC
Created attachment 67151 [details]
A query longer than 65535; this will be truncated when saved.

The field saved_sql.savedsql is type 'text', which is 65535 characters long.

mysql> select table_name, column_name, data_type from information_schema.columns where column_name = 'savedsql';
+------------+-------------+-----------+
| table_name | column_name | data_type |
+------------+-------------+-----------+
| saved_sql  | savedsql    | text      |
+------------+-------------+-----------+

The query editor in  guided_reports.pl does not check the size of the report being saved, causing the report to be truncated if its more than 65535 characters long.

I would suggest changing the data type of savedsql to LONGTEXT, then limiting the query length to something fairly large, but less than 4,294,967,295 characters, with a warning (to avoid denial of service by filling the hard drive).
Comment 1 Barton Chittenden 2017-09-15 15:33:40 UTC
Set to MAJOR because of data loss.
Comment 2 Katrin Fischer 2017-09-15 22:13:55 UTC
Can you give an example of a report (that would be wise to run) that is that long? I think major is too much here, we probably have a lot of fields if not all that cut off data if too long.
Comment 3 Barton Chittenden 2017-09-15 22:17:41 UTC
(In reply to Katrin Fischer from comment #2)
> Can you give an example of a report (that would be wise to run) that is that
> long? I think major is too much here, we probably have a lot of fields if
> not all that cut off data if too long.

Cait,

See the attached file.

It poses no danger when run because it's syntactically incorrect when imported.
Comment 4 Katrin Fischer 2017-09-15 22:19:42 UTC
It just killed my editor... kind of makes me worry if it's wise to recommend it for use with Koha :)
Comment 5 Katrin Fischer 2017-09-15 22:32:15 UTC
Not opposed to make the field bigger, was just wondering.