~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/r/warnings.result

  • Committer: Stewart Smith
  • Date: 2009-05-15 06:57:12 UTC
  • mto: (991.1.5 for-brian)
  • mto: This revision was merged to the branch mainline in revision 1022.
  • Revision ID: stewart@flamingspork.com-20090515065712-bmionylacjmexmmm
Make sql_mode=NO_AUTO_VALUE_ON_ZERO default for Drizzle.

Also fix DEFAULT keyword handling for auto-increment so that it defaults to
NULL and not 0 so that the following is valid and generates two auto-inc
values:

create table t1 (a int auto_increment primary key)
insert into t1 (a) values (default);
insert into t1 (a) values (default);

Important to note that 0 is no longer magic. So this gives you duplicate
primary key error:

insert into t1 (a) values(0);
insert into t1 (a) values(0);

as you've inserted the explicit value of 0 twice.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
SET SQL_WARNINGS=1;
3
3
create table t1 (a int);
4
4
create table t1 (a int);
5
 
ERROR 42S01: Table 'test.t1' already exists
 
5
ERROR 42S01: Table 't1' already exists
6
6
show count(*) errors;
7
7
@@session.error_count
8
8
1
9
9
show errors;
10
10
Level   Code    Message
11
 
Error   1050    Table 'test.t1' already exists
 
11
Error   1050    Table 't1' already exists
12
12
show warnings;
13
13
Level   Code    Message
14
 
Error   1050    Table 'test.t1' already exists
 
14
Error   1050    Table 't1' already exists
15
15
create table t (i);
16
16
ERROR 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 ')' at line 1
17
17
show count(*) errors;
43
43
Note    1051    Unknown table 'not_exists_table'
44
44
drop database if exists not_exists_db;
45
45
Warnings:
46
 
Note    1008    Can't drop schema 'not_exists_db'; schema doesn't exist
 
46
Note    1008    Can't drop database 'not_exists_db'; database doesn't exist
47
47
show count(*) warnings;
48
48
@@session.warning_count
49
49
1
56
56
1
57
57
drop table t1;
58
58
create table t1(a int, b int not null, c date, d char(5));
59
 
load data infile 'DRIZZLETEST_VARDIR/std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
 
59
load data infile '../std_data_ln/warnings_loaddata.dat' into table t1 fields terminated by ',';
60
60
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
61
61
select @@warning_count;
62
62
@@warning_count
152
152
set @c = repeat(' ', 256);
153
153
set @q = repeat('q', 256);
154
154
insert into t1 values(@c, @c, @c);
155
 
ERROR 22001: Data too long for column 'c_char' at row 1
 
155
Warnings:
 
156
Note    1265    Data truncated for column 'c_char' at row 1
 
157
Note    1265    Data truncated for column 'c_varchar' at row 1
156
158
show warnings;
157
159
Level   Code    Message
158
 
Error   1406    Data too long for column 'c_char' at row 1
 
160
Note    1265    Data truncated for column 'c_char' at row 1
 
161
Note    1265    Data truncated for column 'c_varchar' at row 1
159
162
insert into t1 values(@q, NULL, NULL);
160
163
ERROR 22001: Data too long for column 'c_char' at row 1
161
164
insert into t1 values(NULL, @q, NULL);