Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.3(EOL)
Description
create table t1 (i int); |
insert into t1 values (1); |
insert into t1 select values(i) from t1; |
select * from t1; |
As documented, function VALUES only makes actual sense in INSERT .. ON DUPLICATE KEY UPDATE statements, and in other cases it returns NULL. It is indeed so with 10.2 (and before, and with MySQL):
MariaDB [test]> insert into t1 select values(i) from t1; |
Query OK, 1 row affected (0.05 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
|
|
MariaDB [test]> select * from t1; |
+------+ |
| i |
|
+------+ |
| 1 |
|
| NULL | |
+------+ |
2 rows in set (0.00 sec) |
However 10.3 does not allow it anymore:
MariaDB [test]> insert into t1 select values(i) from t1; |
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 'values(i) from t1' at line 1 |
MariaDB [test]> select * from t1; |
+------+ |
| i |
|
+------+ |
| 1 |
|
+------+ |
1 row in set (0.00 sec) |
And this works instead:
MariaDB [test]> insert into t1 select value(i) from t1; |
Query OK, 1 row affected (0.04 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|
|
|
MariaDB [test]> select * from t1; |
+------+ |
| i |
|
+------+ |
| 1 |
|
| NULL | |
+------+ |
2 rows in set (0.00 sec) |
I suppose it can break various upgrade scenarios, so if it's intentional, hopefully there is a good enough reason for that; in this case, please re-categorize it as a documentation issue.