From 729ed7806366e55d81413b251132046a026927c6 Mon Sep 17 00:00:00 2001 From: "O. Libre" Date: Sun, 3 Nov 2019 11:52:42 +0100 Subject: [PATCH 1/2] FIX the SELECT examine more than MAX_JOIN_SIZE rows #12305 --- htdocs/accountancy/customer/list.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/customer/list.php b/htdocs/accountancy/customer/list.php index 7826d2b1faf..e14d6211cbc 100644 --- a/htdocs/accountancy/customer/list.php +++ b/htdocs/accountancy/customer/list.php @@ -311,6 +311,9 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $sql .= $db->plimit($limit + 1, $offset); dol_syslog("accountancy/customer/list.php", LOG_DEBUG); +// MAX_JOIN_SIZE can be very low (ex: 300000) on some limited configurations (ex: https://www.online.net/fr/hosting/online-perso) +// This big SELECT command may exceed the MAX_JOIN_SIZE limit => Therefore we use SQL_BIG_SELECTS=1 to disable the MAX_JOIN_SIZE security +$db->query("SET SQL_BIG_SELECTS=1"); $result = $db->query($sql); if ($result) { $num_lines = $db->num_rows($result); @@ -418,7 +421,7 @@ if ($result) { $facture_static = new Facture($db); $product_static = new Product($db); - $isSellerInEEC = isInEEC($mysoc); + $isSellerInEEC = isInEEC($mysoc); while ($i < min($num_lines, $limit)) { $objp = $db->fetch_object($result); @@ -587,6 +590,7 @@ if ($result) { } else { print $db->error(); } +$db->query("SET SQL_BIG_SELECTS=0"); // Enable MAX_JOIN_SIZE limitation // Add code to auto check the box when we select an account print '