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

fix #961 #962

Merged
merged 4 commits into from
May 6, 2021
Merged

fix #961 #962

merged 4 commits into from
May 6, 2021

Conversation

Fanduzi
Copy link
Contributor

@Fanduzi Fanduzi commented Apr 29, 2021

fix #961

A Pull Request should be associated with an Issue.

We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
and potentially we'll be able to point development in a particular direction.

Related issue: https://github.com/github/gh-ost/issues/0123456789

Further notes in https://github.com/github/gh-ost/blob/master/.github/CONTRIBUTING.md
Thank you! We are open to PRs, but please understand if for technical reasons we are unable to accept each and any PR

Description

https://dev.mysql.com/doc/refman/8.0/en/keywords.html
ROWS (R); became reserved in 8.0.2

if we use -exact-rowcount option, gh-ost will execute query

select /* gh-ost */ count(*) as rows from `db`.`t1`;

which will cause

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'rows from `db`.`t1`' at line 1

Please use ```

select /* gh-ost */ count(*) as `rows` from `db`.`t1`;

In case this PR introduced Go code changes:

  • contributed code is using same conventions as original code
  • script/cibuild returns with no formatting errors, build errors or unit test errors.

Copy link
Contributor

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

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

Suggestion: change to an altogether different alias, such as count_rows. I find that it's generally not a good idea to qualify reserved words; analysis tools, scripts etc. do not play well with qualified reserved words.

@Fanduzi
Copy link
Contributor Author

Fanduzi commented Apr 29, 2021

Suggestion: change to an altogether different alias, such as count_rows. I find that it's generally not a good idea to qualify reserved words; analysis tools, scripts etc. do not play well with qualified reserved words.

Sorry, actually I don't know golang programming... So I just added a quote. I have now changed the column alias to count_rows

Copy link
Contributor

@shlomi-noach shlomi-noach left a comment

Choose a reason for hiding this comment

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

LGTM

@timvaillancourt
Copy link
Collaborator

Merging without replica testing as this is low risk

@timvaillancourt timvaillancourt merged commit 0a1fb97 into github:master May 6, 2021
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.

mysql8.0.2+ -exact-rowcount bug
3 participants