diff -u b/panels.install b/panels.install --- b/panels.install +++ b/panels.install @@ -448,10 +448,11 @@ // Initialize information needed by the batch update system. if (!isset($sandbox['progress'])) { $sandbox['progress'] = 0; - $sandbox['max'] = db_query('SELECT COUNT(DISTINCT pd.did) FROM {panels_display} pd + // Must use this strange query structure to avoid this MySQL bug: http://bugs.mysql.com/bug.php?id=30402 + $sandbox['max'] = db_query('SELECT COUNT(*) FROM (SELECT DISTINCT pd.did FROM {panels_display} pd LEFT JOIN {panels_pane} pp ON pp.did = pd.did WHERE pd.uuid = \'\' OR pd.uuid IS NULL OR pp.uuid = \'\' OR pp.uuid IS NULL -ORDER BY pd.did') +ORDER BY pd.did) countalias') ->fetchField(); // If there's no data, don't bother with the extra work. if (empty($sandbox['max'])) {