You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql-test/r/parser.result
+227Lines changed: 227 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -650,3 +650,230 @@ CREATE TABLE t1(a INT);
650
650
SELECT * FROM t1 JOIN ((SELECT 1 AS b) UNION ALL (SELECT 2 AS b) ORDER BY b DESC) s1 WHERE a=1;
651
651
a b
652
652
DROP TABLE t1;
653
+
#
654
+
# Test of collective fix for three parser bugs:
655
+
#
656
+
# Bug #17727401, Bug #17426017, Bug #17473479:
657
+
# The server accepts wrong syntax and then fails in different ways
658
+
#
659
+
CREATE TABLE t1 (i INT);
660
+
# bug #17426017
661
+
SELECT (SELECT EXISTS(SELECT * LIMIT 1 ORDER BY VALUES (c00)));
662
+
ERROR 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 'ORDER BY VALUES (c00)))' at line 1
663
+
# bug#17473479
664
+
CREATE TABLE a(a int);
665
+
CREATE TABLE b(a int);
666
+
DELETE FROM b ORDER BY(SELECT 1 FROM a ORDER BY a ORDER BY a);
667
+
ERROR 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 'ORDER BY a)' at line 1
668
+
DROP TABLE a, b;
669
+
# bug #17727401
670
+
SELECT '' IN (SELECT '1' c FROM t1 ORDER BY '' ORDER BY '') FROM t1;
671
+
ERROR 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 'ORDER BY '') FROM t1' at line 1
672
+
# regression & coverage tests
673
+
# uniform syntax for FROM DUAL clause:
674
+
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
675
+
FOR UPDATE;
676
+
1
677
+
1
678
+
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
679
+
PROCEDURE ANALYSE() FOR UPDATE;
680
+
ERROR HY000: Can't use ORDER clause with this procedure
681
+
SELECT 1 FROM
682
+
(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
683
+
FOR UPDATE) a;
684
+
1
685
+
1
686
+
SELECT 1 FROM
687
+
(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
688
+
PROCEDURE ANALYSE() FOR UPDATE) a;
689
+
ERROR HY000: Incorrect usage of PROCEDURE and subquery
690
+
SELECT 1 FROM t1
691
+
WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
692
+
FOR UPDATE);
693
+
1
694
+
SELECT 1 FROM t1
695
+
WHERE EXISTS(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
696
+
PROCEDURE ANALYSE() FOR UPDATE);
697
+
ERROR HY000: Incorrect usage of PROCEDURE and subquery
698
+
SELECT 1 FROM t1
699
+
UNION
700
+
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
701
+
FOR UPDATE;
702
+
1
703
+
1
704
+
SELECT 1 FROM t1
705
+
UNION
706
+
SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
707
+
PROCEDURE ANALYSE() FOR UPDATE;
708
+
ERROR HY000: Incorrect usage of PROCEDURE and subquery
709
+
SELECT 1 FROM DUAL PROCEDURE ANALYSE()
710
+
UNION
711
+
SELECT 1 FROM t1;
712
+
ERROR HY000: Incorrect usage of UNION and SELECT ... PROCEDURE ANALYSE()
713
+
(SELECT 1 FROM t1)
714
+
UNION
715
+
(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
716
+
FOR UPDATE);
717
+
1
718
+
1
719
+
(SELECT 1 FROM t1)
720
+
UNION
721
+
(SELECT 1 FROM DUAL WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1
722
+
PROCEDURE ANALYSE() FOR UPDATE);
723
+
ERROR HY000: Incorrect usage of PROCEDURE and subquery
724
+
# "FOR UPDATE" tests
725
+
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
726
+
1
727
+
SELECT 1 FROM t1 FOR UPDATE UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
728
+
1
729
+
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 FOR UPDATE;
730
+
1
731
+
# "INTO" clause tests
732
+
SELECT 1 FROM t1 INTO @var17727401;
733
+
Warnings:
734
+
Warning 1329 No data - zero rows fetched, selected, or processed
735
+
SELECT 1 FROM DUAL INTO @var17727401;
736
+
SELECT 1 INTO @var17727401;
737
+
SELECT 1 INTO @var17727401 FROM t1;
738
+
Warnings:
739
+
Warning 1329 No data - zero rows fetched, selected, or processed
740
+
SELECT 1 INTO @var17727401 FROM DUAL;
741
+
SELECT 1 INTO @var17727401_1 FROM t1 INTO @var17727401_2;
742
+
ERROR HY000: Incorrect usage of INTO and INTO
743
+
SELECT 1 INTO @var17727401_1 FROM DUAL
744
+
INTO @var17727401_2;
745
+
ERROR HY000: Incorrect usage of INTO and INTO
746
+
SELECT 1 INTO @var17727401 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
747
+
Warnings:
748
+
Warning 1329 No data - zero rows fetched, selected, or processed
749
+
SELECT 1 FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1 INTO @var17727401;
750
+
Warnings:
751
+
Warning 1329 No data - zero rows fetched, selected, or processed
752
+
SELECT 1 FROM t1 WHERE 1 INTO @var17727401 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1;
753
+
ERROR 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 'GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1' at line 1
754
+
SELECT 1 INTO @var17727401_1
755
+
FROM t1 WHERE 1 GROUP BY 1 HAVING 1 ORDER BY 1 LIMIT 1
756
+
INTO @var17727401_2;
757
+
ERROR HY000: Incorrect usage of INTO and INTO
758
+
SELECT (SELECT 1 FROM t1 INTO @var17727401);
759
+
ERROR 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 'INTO @var17727401)' at line 1
760
+
SELECT 1 FROM (SELECT 1 FROM t1 INTO @var17727401) a;
761
+
ERROR 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 'INTO @var17727401) a' at line 1
762
+
SELECT EXISTS(SELECT 1 FROM t1 INTO @var17727401);
763
+
ERROR 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 'INTO @var17727401)' at line 1
764
+
SELECT 1 FROM t1 INTO @var17727401 UNION SELECT 1 FROM t1 INTO t1;
765
+
ERROR HY000: Incorrect usage of UNION and INTO
766
+
(SELECT 1 FROM t1 INTO @var17727401) UNION (SELECT 1 FROM t1 INTO t1);
767
+
ERROR HY000: Incorrect usage of UNION and INTO
768
+
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 INTO @var17727401;
769
+
Warnings:
770
+
Warning 1329 No data - zero rows fetched, selected, or processed
771
+
SELECT 1 INTO @var17727401 FROM t1 PROCEDURE ANALYSE();
772
+
ERROR HY000: Incorrect usage of PROCEDURE and INTO
773
+
SELECT 1 FROM t1 PROCEDURE ANALYSE() INTO @var17727401;
774
+
ERROR HY000: Incorrect usage of PROCEDURE and INTO
775
+
# ORDER and LIMIT clause combinations
776
+
(SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1;
777
+
1
778
+
(SELECT 1 FROM t1 LIMIT 1) LIMIT 1;
779
+
1
780
+
((SELECT 1 FROM t1 ORDER BY 1) ORDER BY 1) ORDER BY 1;
781
+
ERROR 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 'ORDER BY 1) ORDER BY 1' at line 1
782
+
((SELECT 1 FROM t1 LIMIT 1) LIMIT 1) LIMIT 1;
783
+
ERROR 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 'LIMIT 1) LIMIT 1' at line 1
784
+
(SELECT 1 FROM t1 ORDER BY 1) LIMIT 1;
785
+
1
786
+
(SELECT 1 FROM t1 LIMIT 1) ORDER BY 1;
787
+
1
788
+
((SELECT 1 FROM t1 ORDER BY 1) LIMIT 1) ORDER BY 1);
789
+
ERROR 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 'LIMIT 1) ORDER BY 1)' at line 1
790
+
((SELECT 1 FROM t1 LIMIT 1) ORDER BY 1) LIMIT 1);
791
+
ERROR 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 'ORDER BY 1) LIMIT 1)' at line 1
792
+
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1;
793
+
1
794
+
SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1);
795
+
(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1)
796
+
NULL
797
+
SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
798
+
1
799
+
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1;
800
+
1
801
+
SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1);
802
+
(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1)
803
+
NULL
804
+
SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1) a;
805
+
1
806
+
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1;
807
+
1
808
+
SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1);
809
+
(SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1)
810
+
NULL
811
+
SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 ORDER BY 1 LIMIT 1) a;
812
+
1
813
+
SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1;
814
+
ERROR 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 'ORDER BY 1' at line 1
815
+
SELECT (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1);
816
+
ERROR 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 'ORDER BY 1)' at line 1
817
+
SELECT 1 FROM (SELECT 1 FROM t1 UNION SELECT 1 FROM t1 LIMIT 1 ORDER BY 1) a;
818
+
ERROR 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 'ORDER BY 1) a' at line 1
819
+
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1;
820
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
821
+
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1);
822
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
823
+
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1) a;
824
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
825
+
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1;
826
+
ERROR HY000: Incorrect usage of UNION and LIMIT
827
+
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1);
828
+
ERROR HY000: Incorrect usage of UNION and LIMIT
829
+
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1) a;
830
+
ERROR HY000: Incorrect usage of UNION and LIMIT
831
+
SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1;
832
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
833
+
SELECT (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1);
834
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
835
+
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 LIMIT 1 UNION SELECT 1 FROM t1) a;
836
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
837
+
SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1;
838
+
ERROR 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 'ORDER BY 1 UNION SELECT 1 FROM t1' at line 1
839
+
SELECT (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1);
840
+
ERROR 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 'ORDER BY 1 UNION SELECT 1 FROM t1)' at line 1
841
+
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1) a;
842
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
843
+
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1;
844
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
845
+
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1);
846
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
847
+
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
848
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
849
+
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1;
850
+
ERROR HY000: Incorrect usage of UNION and LIMIT
851
+
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1);
852
+
ERROR HY000: Incorrect usage of UNION and LIMIT
853
+
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
854
+
ERROR HY000: Incorrect usage of UNION and LIMIT
855
+
SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1;
856
+
ERROR HY000: Incorrect usage of UNION and LIMIT
857
+
SELECT (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1);
858
+
ERROR HY000: Incorrect usage of UNION and LIMIT
859
+
SELECT 1 FROM (SELECT 1 FROM t1 LIMIT 1 UNION SELECT 1 FROM t1 ORDER BY 1) a;
860
+
ERROR HY000: Incorrect usage of UNION and LIMIT
861
+
SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1;
862
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
863
+
SELECT (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1);
864
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
865
+
SELECT 1 FROM (SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 LIMIT 1) a;
866
+
ERROR HY000: Incorrect usage of UNION and ORDER BY
867
+
DROP TABLE t1;
868
+
#
869
+
# MDEV-8380: Subquery parse error
870
+
#
871
+
CREATE TABLE t1 ( a INT);
872
+
INSERT INTO t1 VALUES ( 2 );
873
+
SELECT *
874
+
FROM ( (SELECT a FROM t1 ORDER BY a) UNION (SELECT 1 as b ORDER BY b ) ) AS a1
Copy file name to clipboardExpand all lines: mysql-test/r/subselect.result
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5138,8 +5138,9 @@ SELECT a FROM t1 WHERE a = 2
5138
5138
a
5139
5139
1
5140
5140
2
5141
-
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
5142
-
ERROR 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 ')' at line 1
5141
+
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q;
5142
+
a
5143
+
1
5143
5144
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
5144
5145
a
5145
5146
1
@@ -5181,7 +5182,7 @@ a 1
5181
5182
1 1
5182
5183
2 1
5183
5184
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
5184
-
ERROR 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 ')) ON 1' at line 1
5185
+
ERROR 42000: Every derived table must have its own alias
5185
5186
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
5186
5187
ERROR 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 ') ON 1' at line 1
5187
5188
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
@@ -5300,7 +5301,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
5300
5301
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
5301
5302
ERROR 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 1 ) )' at line 1
5302
5303
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
5303
-
ERROR 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 1 )' at line 1
5304
+
ERROR 42000: Every derived table must have its own alias
5305
+
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
5306
+
1
5307
+
1
5304
5308
SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_no_exists_to_in.result
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5140,8 +5140,9 @@ SELECT a FROM t1 WHERE a = 2
5140
5140
a
5141
5141
1
5142
5142
2
5143
-
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
5144
-
ERROR 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 ')' at line 1
5143
+
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q;
5144
+
a
5145
+
1
5145
5146
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
5146
5147
a
5147
5148
1
@@ -5183,7 +5184,7 @@ a 1
5183
5184
1 1
5184
5185
2 1
5185
5186
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
5186
-
ERROR 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 ')) ON 1' at line 1
5187
+
ERROR 42000: Every derived table must have its own alias
5187
5188
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
5188
5189
ERROR 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 ') ON 1' at line 1
5189
5190
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
@@ -5302,7 +5303,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
5302
5303
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
5303
5304
ERROR 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 1 ) )' at line 1
5304
5305
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
5305
-
ERROR 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 1 )' at line 1
5306
+
ERROR 42000: Every derived table must have its own alias
5307
+
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
5308
+
1
5309
+
1
5306
5310
SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_no_mat.result
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5138,8 +5138,9 @@ SELECT a FROM t1 WHERE a = 2
5138
5138
a
5139
5139
1
5140
5140
2
5141
-
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
5142
-
ERROR 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 ')' at line 1
5141
+
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q;
5142
+
a
5143
+
1
5143
5144
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
5144
5145
a
5145
5146
1
@@ -5181,7 +5182,7 @@ a 1
5181
5182
1 1
5182
5183
2 1
5183
5184
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
5184
-
ERROR 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 ')) ON 1' at line 1
5185
+
ERROR 42000: Every derived table must have its own alias
5185
5186
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
5186
5187
ERROR 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 ') ON 1' at line 1
5187
5188
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
@@ -5300,7 +5301,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
5300
5301
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
5301
5302
ERROR 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 1 ) )' at line 1
5302
5303
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
5303
-
ERROR 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 1 )' at line 1
5304
+
ERROR 42000: Every derived table must have its own alias
5305
+
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
5306
+
1
5307
+
1
5304
5308
SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_no_opts.result
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5134,8 +5134,9 @@ SELECT a FROM t1 WHERE a = 2
5134
5134
a
5135
5135
1
5136
5136
2
5137
-
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
5138
-
ERROR 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 ')' at line 1
5137
+
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q;
5138
+
a
5139
+
1
5139
5140
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
5140
5141
a
5141
5142
1
@@ -5177,7 +5178,7 @@ a 1
5177
5178
1 1
5178
5179
2 1
5179
5180
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
5180
-
ERROR 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 ')) ON 1' at line 1
5181
+
ERROR 42000: Every derived table must have its own alias
5181
5182
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
5182
5183
ERROR 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 ') ON 1' at line 1
5183
5184
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
@@ -5296,7 +5297,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
5296
5297
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
5297
5298
ERROR 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 1 ) )' at line 1
5298
5299
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
5299
-
ERROR 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 1 )' at line 1
5300
+
ERROR 42000: Every derived table must have its own alias
5301
+
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
5302
+
1
5303
+
1
5300
5304
SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_no_scache.result
+8-4Lines changed: 8 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -5144,8 +5144,9 @@ SELECT a FROM t1 WHERE a = 2
5144
5144
a
5145
5145
1
5146
5146
2
5147
-
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a);
5148
-
ERROR 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 ')' at line 1
5147
+
SELECT * FROM ((SELECT 1 a) UNION SELECT 1 a) q;
5148
+
a
5149
+
1
5149
5150
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a)) alias;
5150
5151
a
5151
5152
1
@@ -5187,7 +5188,7 @@ a 1
5187
5188
1 1
5188
5189
2 1
5189
5190
SELECT * FROM t1 JOIN ((SELECT 1 UNION SELECT 1)) ON 1;
5190
-
ERROR 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 ')) ON 1' at line 1
5191
+
ERROR 42000: Every derived table must have its own alias
5191
5192
SELECT * FROM t1 JOIN (t1 t1a UNION SELECT 1) ON 1;
5192
5193
ERROR 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 ') ON 1' at line 1
5193
5194
SELECT * FROM t1 JOIN ((t1 t1a UNION SELECT 1)) ON 1;
@@ -5306,7 +5307,10 @@ SELECT ((SELECT 1 UNION SELECT 1 UNION SELECT 1));
5306
5307
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
5307
5308
ERROR 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 1 ) )' at line 1
5308
5309
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
5309
-
ERROR 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 1 )' at line 1
5310
+
ERROR 42000: Every derived table must have its own alias
5311
+
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 ) a;
5312
+
1
5313
+
1
5310
5314
SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
0 commit comments