Bug 21906 - WHERE clause doesn't like % in CONCAT
Summary: WHERE clause doesn't like % in CONCAT
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Reports (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 9634
Blocks:
  Show dependency treegraph
 
Reported: 2018-11-28 20:06 UTC by Christopher Brannon
Modified: 2018-12-07 20:53 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Brannon 2018-11-28 20:06:47 UTC
In previous versions of Koha, I have been able to create a field that could have some information or be left blank in the WHERE clause, such as:

WHERE itemcallnumber LIKE CONCAT(<<Start of call number>>,'%')

Starting with 18.05, Koha will give me results, but it will give me blank results with the header if I download.  If I use something else, it will populate in the download just fine.  The % seems to be interfering with the download process.
Comment 1 Christopher Brannon 2018-11-28 20:22:58 UTC
More specifically, the CONCAT does not work in the download now with the % if the field is blank.  If I have anything else, it works fine, but displaying and downloading.
Comment 2 Christopher Brannon 2018-11-28 20:34:25 UTC
If I use CONCAT(IFNULL(<<Gimme>>,""),"%"), it works.  Something has changed (only with downloads) that causes the report to barf if the field is blank (null).
Comment 3 Jonathan Druart 2018-12-07 19:25:46 UTC
I have tried:
- Create a new report from SQL

SELECT itemnumber, itemcallnumber FROM items WHERE itemcallnumber LIKE CONCAT(<<Start of call number>>,'%')

- Execute
- Enter "a"
=> Return 2 results
- Export (csv, tab, ods)
=> Return 2 results

on master
Comment 4 Christopher Brannon 2018-12-07 19:48:19 UTC
(In reply to Jonathan Druart from comment #3)
> I have tried:
> - Create a new report from SQL
> 
> SELECT itemnumber, itemcallnumber FROM items WHERE itemcallnumber LIKE
> CONCAT(<<Start of call number>>,'%')
> 
> - Execute
> - Enter "a"
> => Return 2 results
> - Export (csv, tab, ods)
> => Return 2 results
> 
> on master

And what happens if you don't fill in the field?
Comment 5 Jonathan Druart 2018-12-07 20:04:43 UTC
Ha! That was the important bit indeed :)
Comment 6 Jonathan Druart 2018-12-07 20:22:30 UTC
At first glance it is caused by bug 9634.
Comment 7 Christopher Brannon 2018-12-07 20:53:42 UTC
(In reply to Jonathan Druart from comment #6)
> At first glance it is caused by bug 9634.

That would be my guess.  It broke after this was introduced.