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

plan :fix the compatibility problem of UNION statement #6370

Merged
merged 5 commits into from
Apr 25, 2018

Conversation

spongedu
Copy link
Contributor

In MySQL, LIMIT, ORDER BY is not allowed in the first few SelectStmts. For example:

mysql> CREATE TABLE IF NOT EXISTS `t` (
    ->   `id` int(6) unsigned NOT NULL,
    ->   `tn` int(3) unsigned NOT NULL,
    ->   `type` varchar(200) NOT NULL,
    ->   PRIMARY KEY (`id`,`tn`)
    -> ) DEFAULT CHARSET=utf8;
Query OK, 0 rows affected (0.05 sec)

mysql> INSERT INTO `t` (`id`, `tn`, `type`) VALUES
    ->   ('1', '5', 'cat'),
    ->   ('2', '6', 'dog'),
    ->   ('3', '7', 'duck'),
    ->   ('4', '8', 'chicken');
Query OK, 4 rows affected (0.02 sec)
Records: 4  Duplicates: 0  Warnings: 0
mysql> select * from t limit 1 offset 2 union select 1,2,3 from dual;
ERROR 1221 (HY000): Incorrect usage of UNION and LIMIT
mysql> select * from t order by id  union select 1,2,3 from dual;
ERROR 1221 (HY000): Incorrect usage of UNION and ORDER BY

@spongedu spongedu changed the title plan :fix the compatibility problem of statement plan :fix the compatibility problem of UNION statement Apr 24, 2018
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason
Copy link
Member

/run-all-tests

@zz-jason zz-jason added status/LGT1 Indicates that a PR has LGTM 1. contribution This PR is from a community contributor. labels Apr 25, 2018
@shenli
Copy link
Member

shenli commented Apr 25, 2018

@spongedu Thanks!
Please merge the latest master to fix the CI.

@shenli
Copy link
Member

shenli commented Apr 25, 2018

/run-all-tests

@shenli
Copy link
Member

shenli commented Apr 25, 2018

LGTM

@shenli shenli added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Apr 25, 2018
@zz-jason
Copy link
Member

I think we can cherry pick this patch to release 2.0

@shenli
Copy link
Member

shenli commented Apr 25, 2018

@zz-jason Agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants