Bug 23982: (bug 23624 follow-up) Handle SQL error caused by derived table
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 18 Nov 2019 10:20:46 +0000 (11:20 +0100)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Tue, 19 Nov 2019 15:09:19 +0000 (15:09 +0000)
commit24f780e22f68fb0e5968ae065cf0f73a9c978799
tree494a2a868a48274e279aca3c10f270577eb29314
parent468513a5de60696a7d98ca64ba5d5babaddbbaa5
Bug 23982: (bug 23624 follow-up) Handle SQL error caused by derived table

Caused by
  commit bca4453c50d8b5b1d3c7029ded2b522a9a2bf868
  Bug 23624: (QA follow-up) Optimize even more

A report like:
SELECT * FROM issues JOIN borrowers USING (borrowernumber)

will have two borrowernumber columns - SQL will give us there rsults,
but if we try to wrap them in a SELECT COUNT(*) FROM (report) it throws
a duplicated column error.

This patch suggests to execute the query the old way if the derived
table optimization failed.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
C4/Reports/Guided.pm