Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
10.1.20, 10.2.16, 10.3(EOL), 10.4(EOL)
-
Tested in ubuntu 16.04 (xenial)
Description
Creating a table with a PK plus a SELECT statement leads to 2 different behaviors depending on the column matching names or not.
Here are 3 examples, the first 2 cases with non matching column names and the third matching:
create-table-select.sql |
MariaDB [test]> CREATE TABLE myTable (myField int, PRIMARY KEY(myField)) AS SELECT 1;
|
ERROR 1364 (HY000): Field 'myField' doesn't have a default value
|
|
MariaDB [test]> CREATE TABLE myTable (myField int, PRIMARY KEY(myField)) AS SELECT 1 as myField2;
|
ERROR 1364 (HY000): Field 'myField' doesn't have a default value
|
|
MariaDB [test]> CREATE TABLE myTable (myField int, PRIMARY KEY(myField)) AS SELECT 1 as myField;
|
Query OK, 1 row affected (0.00 sec)
|
Records: 1 Duplicates: 0 Warnings: 0
|