If a pager is missing, then appears when using another theme, does that narrow the problem to the original theme? I have a pager missing from one page, while visible on another. These pages are generated by my custom module. I'm working with a custom theme that's been hacked together (wasn't me!) When I switch the theme to Bartik everything works as expected.

Here is the query function:

function query_activities($tid = NULL, $did = NULL) {
  $record_count = variable_get('promo_list_count');
  $query = db_select('node', 'n')-&gt;extend('PagerDefault');
  $query-&gt;fields('n', array('nid', 'title'));
  if ($tid) {
    $query-&gt;leftJoin('taxonomy_index', 'ti', 'ti.nid = n.nid');
    $query-&gt;condition('ti.tid', $tid);
  }
  $query-&gt;condition('n.type', 'activity_promo_list');
  $query-&gt;condition('n.status', 1);
  $query-&gt;groupBy('n.nid');
  $query-&gt;orderBy('n.sticky', 'DESC');
  $query-&gt;orderBy('n.promote', 'DESC');
  $query-&gt;orderBy('n.changed', 'DESC');
  $query-&gt;orderBy('n.created', 'DESC');
  $query-&gt;limit($record_count);
  $results = $query-&gt;execute()-&gt;fetchAll();
  return $results;


I have a function that wraps the query results in theme arrays and can post the whole thing if needed (it's 120 lines) but I think the only relevant part is:

  $content['pager'] = array(
  '#theme' =&gt; 'pager',
  '#weight' =&gt; $count,
  '#quantity' =&gt; 5,
  );
  krumo($content['pager']);
  return $content;


The krumo() dump shows the pager array populated on both pages (pager visible &amp; pager missing).

Does this narrow the problem to theme layer? 

What should I look for to fix or diagnose the missing pager?
I stumbled on tostinni's answer in Pager disappears when adding &quot;GROUP BY&quot; in the SQL query.


  Your query with the GROUP BY is incorrect, MySQL is lax enough to let you write this kind of queries but it is by no way recommended. When you use a GROUP BY clause you should group all the columns without a aggregate function.


I then fixed two queries that have poorly formed GROUP BYs, but my pager was still missing. I bust out Devel's query logging feature; the offending SQL query resulted to be used by the Nodequeue module. I checked the bug reports for that module, and found the one about that query: Grouping error" when creating a simple queue (PostgreSQL).