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

planner: include schema name when checking duplicate table aliases #24663

Closed
wants to merge 3 commits into from

Conversation

eurekaka
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #24563
close #24550

Problem Summary:

Incompatible behaviors regarding duplicate table alias check with MySQL.

What is changed and how it works?

What's Changed:

Include schema name when checking duplicate table aliases.

Related changes

N/A

Check List

Tests

  • Unit test

Side effects

N/A

Release note

  • Fix incompatibility of duplicate table alias check with MySQL

@eurekaka eurekaka added type/compatibility type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels May 14, 2021
@eurekaka eurekaka requested a review from a team as a code owner May 14, 2021 09:21
@eurekaka eurekaka requested review from time-and-fate and removed request for a team May 14, 2021 09:21
@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by writing /lgtm in a comment.
Reviewer can cancel approval by writing /lgtm cancel in a comment.

@ti-chi-bot ti-chi-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 14, 2021
@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka
Copy link
Contributor Author

/run-e2e-test

@eurekaka
Copy link
Contributor Author

integration-common-test

@eurekaka
Copy link
Contributor Author

/run-all-tests

@eurekaka eurekaka requested review from qw4990 and winoros May 14, 2021 09:47
@ichn-hu ichn-hu mentioned this pull request May 14, 2021
Copy link
Member

@time-and-fate time-and-fate left a comment

Choose a reason for hiding this comment

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

Found a bad case:
select * from db1.t as t1, (select * from t) as t1;
This is valid on MySQL 8.0.25 but invalid on this PR.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 29, 2021
@ti-chi-bot
Copy link
Member

@eurekaka: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@eurekaka
Copy link
Contributor Author

Well, the behavior difference of MySQL for these 2 queries is pretty confusing.

MySQL [db1]> select * from db1.t as t1, t as t1;
ERROR 1066 (42000): Not unique table/alias: 't1'
MySQL [db1]> select * from db1.t as t1, (select * from t) as t1;
+------+------+
| a    | a    |
+------+------+
|    1 |    1 |
+------+------+
1 row in set (0.00 sec)

@eurekaka
Copy link
Contributor Author

Close this PR until we find another solution to cover all MySQL behaviors.

@longfeiss
Copy link

Well, the behavior difference of MySQL for these 2 queries is pretty confusing.

MySQL [db1]> select * from db1.t as t1, t as t1;
ERROR 1066 (42000): Not unique table/alias: 't1'
MySQL [db1]> select * from db1.t as t1, (select * from t) as t1;
+------+------+
| a    | a    |
+------+------+
|    1 |    1 |
+------+------+
1 row in set (0.00 sec)

tested in MySQL 8.0.27, seems it's valid now

mysql> select version();
+--------------+
| version()    |
+--------------+
| 8.0.27-debug |
+--------------+
1 row in set (0.00 sec)

mysql> select * from db1.t1 as t1, t1 as t1;
Empty set (0.00 sec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. sig/planner SIG: Planner size/M Denotes a PR that changes 30-99 lines, ignoring generated files. type/bugfix This PR fixes a bug. type/compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wrong Not unique table/alias error report Not unique table/alias runs normally
4 participants