pingcap/tidb
View on GitHubset: shouldn't support 'select ... into outfile ... union select ... ' and 'select ... union select SQL_BUFFER_RESULT ... ' statements
Open
#19,097 opened on Aug 10, 2020
challenge-programcomponent/parsergood first issueseverity/minorsig/sql-infratype/compatibility
Repository metrics
- Stars
- (40,090 stars)
- PR merge metrics
- (Avg merge 14d 4h) (346 merged PRs in 30d)
Description
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
drop table if exists t1, t2;
CREATE TABLE t1 (a int not null, b char (10) not null);
insert into t1 values(1,'a'),(2,'b'),(3,'c'),(3,'c');
CREATE TABLE t2 (a int not null, b char (10) not null);
insert into t2 values (3,'c'),(4,'d'),(5,'f'),(6,'e');
select a,b from t1 into outfile 'skr' union select a,b from t2;
select * from t1 union select SQL_BUFFER_RESULT * from t2;
2. What did you expect to see? (Required)
in MySQL or MariaDB
mysql> select a,b from t1 into outfile 'skr' union select a,b from t2;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'union select a,b from t2' at line 1
mysql> select * from t1 union select SQL_BUFFER_RESULT * from t2;
ERROR 1234 (42000): Incorrect usage/placement of 'SQL_BUFFER_RESULT'
3. What did you see instead (Required)
mysql> select a,b from t1 into outfile 'skr' union select a,b from t2;
+---+------+
| a | b |
+---+------+
| 3 | c |
| 4 | d |
| 5 | f |
| 6 | e |
| 2 | b |
| 1 | a |
+---+------+
6 rows in set (0.00 sec)
mysql> select * from t1 union select SQL_BUFFER_RESULT * from t2;
+---+------+
| a | b |
+---+------+
| 1 | a |
| 2 | b |
| 4 | d |
| 5 | f |
| 6 | e |
| 3 | c |
+---+------+
6 rows in set (0.00 sec)
4. What is your TiDB version? (Required)
Release Version: v4.0.0-beta.2-921-gb75a30fda
Edition: Community
Git Commit Hash: b75a30fda8eef5962e2fde1c6254ff02f330fd21
Git Branch: master
UTC Build Time: 2020-08-10 02:44:14
GoVersion: go1.14.6
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
SIG slack channel
Score
- 300
Mentor
- @qw4990