While working on refactoring the test suite, I observed some odd behaviour, which I tracked down to this query:
const char SHOW_ALL_CATEGORIES[] =
"SELECT DISTINCT CATEGORIES FROM REMOTE_PKG WHERE "
"CATEGORIES NOT LIKE '%% %%' ORDER BY CATEGORIES DESC;";
The problem is that this assumes that each category will have at least one package where it is the sole category. Instead each space-separated category should be parsed individually and then build the distinct list from there.