[Koha-bugs] [Bug 8594] A report containing a subquery that has a 'limit' will have that limit stripped out

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Aug 17 01:42:04 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8594

Nicole C. Engard <nengard at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #11453|0                           |1
        is obsolete|                            |

--- Comment #5 from Nicole C. Engard <nengard at gmail.com> ---
Created attachment 11654
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11654&action=edit
[SIGNED-OFF] Bug 8594 - prevent the report system from breaking some subqueries

If you had a report query that had a subquery in the fields list, and
that subquery had a LIMIT specifier, then it would be removed which
could break your query. This patch prevents this case from breaking by
ensuring that only a LIMIT that follows the last WHERE in the query is
removed.

If you don't have a WHERE, then it will behave like it always
did, removing all the cases of LIMIT (which would still break a subquery
but this is a) more rare, and b) would require more intelligent parsing
to deal with.

Also adds test cases and function documentation.

Signed-off-by: Nicole C. Engard <nengard at bywatersolutions.com>

Tested with this report:

select biblionumber, (select itemnumber from items where
items.biblionumber=biblio.biblionumber LIMIT 1) from biblio where
biblionumber<1000;

and it worked like a charm

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list