Skip to content
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

This should fix MySQL 5.7 issues caused by ONLY_FULL_GROUP_BY #5973

Closed
wants to merge 1 commit into from

Conversation

wucdbm
Copy link
Contributor

@wucdbm wucdbm commented Aug 12, 2016

First of all, I have to say that this is my first pull request ever created

This should fix MySQL 5.7 issues caused by ONLY_FULL_GROUP_BY

The proposed code works for me, maybe others could share opinions on a fix for this, it is very annoying when working with new versions of MySQL

Should fix MySQL 5.7 issues caused by ONLY_FULL_GROUP_BY
@wucdbm
Copy link
Contributor Author

wucdbm commented Aug 12, 2016

#5622

@wucdbm wucdbm changed the title Should fix MySQL 5.7 issues caused by ONLY_FULL_GROUP_BY This should fix MySQL 5.7 issues caused by ONLY_FULL_GROUP_BY Aug 12, 2016
@buffcode
Copy link

CI currently fails because of tests expect string equality. PR will probably need to contain the updated tests in order to get merged.

@wucdbm
Copy link
Contributor Author

wucdbm commented Aug 15, 2016

I am aware.

However, I lack the time to dig into it and change tests accordingly. I also have no clue if and if so, how this would affect other DBMS, so I'll simply leave my code here and hope it would help you guys get a decent solution out of it :)

return $sql;
}

// Rebuild the order by clause to work in the scope of the new select statement
/* @var array $orderBy an array of rebuilt order by items */
$orderBy = $this->rebuildOrderByClauseForOuterScope($orderByClause);
$orderByFields = str_replace([' DESC', ' ASC'], ['', ''], $orderBy);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may have something like ORDER BY ASCII ASC - that would be replaced with ORDER BYII here - no-go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This calls for additional test scenarios for both descending and ascending sorting clauses

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably want to match a series of ((\S+)\s+(ASC|DESC)\s*,?)* here (or similar)

@Ocramius Ocramius added the Bug label Sep 7, 2016
// If the sql statement has an order by clause, we need to wrap it in a new select distinct
// statement
if (! $orderByClause instanceof OrderByClause) {
if (!$orderByClause instanceof OrderByClause) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please revert

@Shandur
Copy link

Shandur commented Apr 26, 2017

I ran into the same problem. The problem is still not fixed? @Ocramius

@theofidry
Copy link

@Shandur doesn't look like it. Maybe you can finish that PR? it doesn't look like much is missing from it.

@Shandur
Copy link

Shandur commented Apr 26, 2017

@theofidry I'll try to do it in few days.

@lukasneubauer
Copy link

hello guys, any progress with this?

@Shandur
Copy link

Shandur commented Jun 7, 2017

@lukasneubauer Hey. May was really busy for me, I didn't have any time to work with it. Gonna try to finish it the next week, I'll have some free time. I'll keep you posted.

@bourdeau
Copy link

bourdeau commented Jun 8, 2017

Hello,

We are all waiting for your PR in our company and I guess we are not the only ones :)

@theofidry
Copy link

@bourdeau then maybe on waiting on it someone could finish this up ;)

@lcobucci
Copy link
Member

@Ocramius I think we can close this one and leave it to merge #6143 (seems more complete), agreed?

@Ocramius
Copy link
Member

@lcobucci yeap.

@Ocramius Ocramius closed this Jun 23, 2017
@Ocramius Ocramius added this to the 2.6.0 milestone Jun 23, 2017
@Ocramius Ocramius self-assigned this Jun 23, 2017
@Ocramius
Copy link
Member

Handled in #6143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants