Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
5.5.38, 10.0.12, 10.3.4, 10.1(EOL)
Description
I never noticed this or never thought it is a problem, but please look at this post:
http://blog.mclaughlinsoftware.com/2014/06/15/mysql-insert-from-query/
The "problem" is that parenthesis are allowed for INSERT (SELECT), but not for INSERT (SELECT UNION), and someone can conclude that INSERT SELECT UNION is not supported:
MariaDB [test]> INSERT INTO t3 (SELECT a, NULL AS b FROM t2); |
Query OK, 3 rows affected (0.08 sec) |
Records: 3 Duplicates: 0 Warnings: 0
|
MariaDB [test]> INSERT INTO t3 (SELECT a, NULL AS b FROM t1 UNION SELECT * 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 * FROM t2)' at line 1 |
MariaDB [test]> INSERT INTO t3 SELECT a, NULL AS b FROM t1 UNION SELECT * FROM t2; |
Query OK, 6 rows affected (0.08 sec) |
Records: 6 Duplicates: 0 Warnings: 0
|
Attachments
Issue Links
- duplicates
-
MDEV-11953 support of brackets (parentheses) in UNION/EXCEPT/INTERSECT operations
- Closed
- relates to
-
MDEV-10028 Syntax error on ((SELECT ...) UNION (SELECT ...))
- Closed
- links to