create table if not exists select from does columns from right to left
Bug #309248 reported by
Monty Taylor
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Drizzle |
Invalid
|
High
|
Stewart Smith |
Bug Description
create table t1 (a int not null, b int, primary key (a));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int NOT NULL,
`b` int,
PRIMARY KEY (`a`)
) ENGINE=InnoDB
insert into t1 values (1,1);
create table if not exists t1 select 2;
query 'create table if not exists t1 select 2' failed: 1364: Field 'a' doesn't have a default value
Another example:
create table t1 select 1,2,3;
create table if not exists t1 select 1,2;
select * from t1;
+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
| 1 | 2 | 3 |
| 0 | 1 | 2 |
+---+---+---+
2 rows in set (0.00 sec)
Aroo?
Changed in drizzle: | |
assignee: | nobody → stewart-flamingspork |
milestone: | none → cirrus |
Changed in drizzle: | |
milestone: | cirrus → aloha |
To post a comment you must log in.
Monty, I can verify the first example, but not the second:
drizzle> use test
Database changed
drizzle> create table t1 (a int not null, b int, primary key (a));
Query OK, 0 rows affected (0.01 sec)
drizzle> show create table t1; -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------+ -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------+ -+----- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------+
+------
| Table | Create Table |
+------
| t1 | CREATE TABLE `t1` (
`a` int NOT NULL,
`b` int,
PRIMARY KEY (`a`)
) ENGINE=InnoDB |
+------
1 row in set (0.00 sec)
drizzle> insert into t1 values (1,1);
Query OK, 1 row affected (0.01 sec)
drizzle> create table if not exists t1 select 2;
ERROR 1364 (HY000): Field 'a' doesn't have a default value
drizzle> drop table t1insert into t1 values (1,1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'into t1 values (1,1)' at line 1
drizzle> drop table t1;
Query OK, 0 rows affected (0.00 sec)
drizzle> insert into t1 values (1,1);
ERROR 1146 (42S02): Table 'test.t1' doesn't exist
drizzle> create table t1 select 1,2,3;
Query OK, 1 row affected (0.01 sec)
Records: 1 Duplicates: 0 Warnings: 0
drizzle> create table if not exists t1 select 1,2;
Query OK, 0 rows affected (0.00 sec)
drizzle> select * from t1;
+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
| 1 | 2 | 3 |
+---+---+---+
1 row in set (0.00 sec)
Can you verify that your second example no longer occurs, please? Thanks, Jay.