The packages page currently uses the kojiweb.util.paginateResults() method, which filters the results in the code rather than in the database. Convert the page to use the paginateMethod() method, which does all filtering in the database. This will require the listPackages() method to handle the queryOpts keyword argument.
Works for me without problems - not tried with really large numbers of packages.
I get an error locally if I try to filter the package list by first letter.
e.g. https://localhost/koji/packages?prefix=p&order=package_name&inherited=1
Traceback (most recent call last): File "/usr/share/koji-web/scripts/wsgi_publisher.py", line 387, in handle_request result = func(environ, **data) File "/usr/share/koji-web/scripts/index.py", line 838, in packages start=start, dataName='packages', prefix='package', order=order) File "/usr/share/koji-web/lib/kojiweb/util.py", line 305, in paginateMethod totalRows = getattr(server, methodName)(*args, **kw) File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 1943, in __call__ return self.__func(self.__name, args, opts) File "/usr/lib/python2.7/site-packages/koji/__init__.py", line 2379, in _callMethod raise err Fault: <Fault 1: '<class \'pg.ProgrammingError\'>: ERROR: syntax error at or near "p"\nLINE 5: WHERE (package.name ILIKE \'\'p\'%\' ESCAPE \'#\')\n
The single quotes around %(prefix)s%% are redundant. The system already quotes such substitutions. This results in an actual query of:
SELECT count(*) FROM package WHERE (package.name ILIKE ''p'%' ESCAPE '#')
I'm not sure its necessary to use ESCAPE here.
Didn't we go through all this in a previous iteration of the patch? This seems very familiar.
Fix here: https://github.com/mikem23/koji-playground/commits/issue600-patch1
1 new commit added
@mikem fixed as your advice.
Commit 87d989f9 fixes this pull-request
Pull-Request has been merged by mikem@redhat.com