Bug 11422

Summary: LIMIT $offset, $limit not compatible with PostgreSQL
Product: Koha Reporter: Galen Charlton <gmcharlt>
Component: Architecture, internals, and plumbingAssignee: Galen Charlton <gmcharlt>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: tmisilo
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 7365    

Description Galen Charlton 2013-12-19 00:24:47 UTC
There are some queries that use "LIMIT $offset, $limit" which PostgreSQL will not accept.  However, PostgreSQL *does* accept "LIMIT $limit OFFSET $offset".  Since MySQL accepts that construct as well, we should use it.

A partial list of code using LIMIT x,y is:


offline_circ/download.pl
reports/borrowers_out.pl
reports/catalogue_out.pl
t/db_dependent/Labels/t_Batch.t
t/db_dependent/Reports/Guided.t
misc/migration_tools/rebuild_zebra.pl
C4/VirtualShelves.pm
C4/Utils/DataTables.pm
C4/Reports/Guided.pm
C4/Review.pm
C4/Serials.pm
C4/NewsChannel.pm (in a comment only)
C4/Koha.pm
C4/Items.pm
C4/Acquisition.pm

Note that because of a quirk in DBI, the technique described at http://www.perlmonks.org/?node_id=837422 needs to be used when using a placeholder for the OFFSET value.
Comment 1 Galen Charlton 2013-12-19 00:26:20 UTC
Also affected is C4/SQLHelper.pm.