Open dpash opened 7 years ago
This problem still exists? Can we please get a fixed version?
This is unbelievable... It's still broken!
As I'm not willing to change my Global MySQL configuration for this broken software, I've implemented this dirty hack:
root@example:/var/www/html/app/database/drivers/mysqli# diff -u mysqli_driver.php.bak mysqli_driver.php
--- mysqli_driver.php.bak 2018-10-13 20:54:11.691704025 +0200
+++ mysqli_driver.php 2018-10-13 20:59:03.819702323 +0200
@@ -74,7 +74,9 @@
}
else
{
- return @mysqli_connect($this->hostname, $this->username, $this->password, $this->database);
+ $connection = @mysqli_connect($this->hostname, $this->username, $this->password, $this->database);
+ $connection->query("SET SESSION sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'");
+ return $connection;
}
}
This works for me using the mysqli
driver:
root@example:/var/www/html# grep driver storage/configuration/database.php
'driver' => 'mysqli',
When MySQL is running under ONLY_FULL_GROUP_BY in sql_mode, as is the default in MySQL 5.7, Koken throws errors.
without ONLY_FULL_GROUP_BY:
With:
In this example, the issue is that there is the album_id column, which is not in the GROUP BY clause. Putting it in demonstrates why this error is reported by MySQL:
As you can see the album_id in the first response is picked roughly by random, but is not correct. We either want to know the total count in all albums, in which case we should remove the album_id from the query, or we want to know counts for each album, in which case it should be in the GROUP BY clause.
There are probably other queries with similar issues.
I would recommend a short term solution of warning in the admin side if this setting is enabled, as it's very hard to debug without quite a bit of know-how.