-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test failure in MySQL 5.7 #5451
Comments
+1 this is a bug; We should not be generating invalid SQL, even if prior mysql versions were forgiving of such syntax. The code that converts grouping queries -> counts could be quite a challenge. Could we accept a less performant (but more robust) solution for certain queries that can't be automatically converted, such as querying the full result, but then discarding after counting rows? |
It looks as though this is what is already being attempted; (3.x head) // we can't clear the select if we're relying on its output by a HAVING clause
if(!empty($this->having)) {
$records = $this->execute();
return $records->numRecords();
}
// Choose a default column
elseif($column == null) {
if($this->groupby) {
$column = 'DISTINCT ' . implode(", ", $this->groupby);
} else {
$column = '*';
}
} |
Hm, I take that back... the problem seems to be with the initial query constructions. $qry = SQLQueryTest_DO::get()->dataQuery()->getFinalisedQuery();
$qry->setGroupBy('"Common"'); This seems like a mis-use, to simply apply a grouping to a dataquery, without specifying the aggregation method? The problem is nothing to do with the count at all, as the $qry object is set to an inconsistent state as soon as the above lines are invoked. We could do one of;
|
From what I can see, Perhaps go with the 3rd case, but throw a warning? Since it works on some version of MySQL, that'll tell people that their code is dumb without breaking things that currently work? |
I've fixed the poor sql usage at #6608. Not sure how to best manage future warnings, yet. |
Future warnings? |
Warnings in case of improper usage. In this case, we just avoid improper usage, but we aren't protecting other users against it. |
This is really down to MySQL changing the meaning of sql_mode ANSI in version 5.7.5. A possible fix that will protect users and modules from creating queries that run under 5.6 but crash under 5.7 would be for framework to explicitly set modes REAL_AS_FLOAT, PIPES_AS_CONCAT, ANSI_QUOTES, & IGNORE_SPACE (the previous definition of "ANSI"), rather than use the ANSI alias, which is not stable. |
Related:#6632 |
I'm getting the following error with MySQL 5.7.11 on my local build. It doesn't happen in Travis.
My assumption is that there is a config setting that makes MySQL a bit more strict (only_full_group_by) that is on by default from MySQL 5.7.5 onwards. We probably want to address this. I can't imagine it's too much of an issue, as PostgreSQL has had this kind of strictness for a long time.
The text was updated successfully, but these errors were encountered: