1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-18 23:03:28 +03:00

More fixes for strict mode:

More tests.
Better error messages.
Fixed bug when checking if we updated all needed columns for INSERT.
Give an error if we encounter a wrong float value during parsing.
Don't print DEFAULT for columns without a default value in SHOW CREATE/SHOW FIELDS.
Fixed UPDATE IGNORE when using STRICT mode.
This commit is contained in:
monty@mishka.local
2004-10-02 22:20:08 +03:00
parent 1fc7e6af85
commit be4ca46fbe
65 changed files with 661 additions and 258 deletions

View File

@ -383,4 +383,5 @@
#define ER_NO_DEFAULT_FOR_FIELD 1364 #define ER_NO_DEFAULT_FOR_FIELD 1364
#define ER_DIVISION_BY_ZERO 1365 #define ER_DIVISION_BY_ZERO 1365
#define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366 #define ER_TRUNCATED_WRONG_VALUE_FOR_FIELD 1366
#define ER_ERROR_MESSAGES 367 #define ER_ILLEGAL_VALUE_FOR_TYPE 1367
#define ER_ERROR_MESSAGES 368

View File

@ -156,7 +156,7 @@ ER_SPATIAL_CANT_HAVE_NULL, "42000", "",
ER_COLLATION_CHARSET_MISMATCH, "42000", "", ER_COLLATION_CHARSET_MISMATCH, "42000", "",
ER_WARN_TOO_FEW_RECORDS, "01000", "", ER_WARN_TOO_FEW_RECORDS, "01000", "",
ER_WARN_TOO_MANY_RECORDS, "01000", "", ER_WARN_TOO_MANY_RECORDS, "01000", "",
ER_WARN_NULL_TO_NOTNULL, "01000", "", ER_WARN_NULL_TO_NOTNULL, "22004", "",
ER_WARN_DATA_OUT_OF_RANGE, "22003", "", ER_WARN_DATA_OUT_OF_RANGE, "22003", "",
ER_WARN_DATA_TRUNCATED, "01000", "", ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_NAME_FOR_INDEX, "42000", "", ER_WRONG_NAME_FOR_INDEX, "42000", "",
@ -202,3 +202,4 @@ ER_SP_VARCOND_AFTER_CURSHNDLR, "42000", "",
ER_SP_CURSOR_AFTER_HANDLER, "42000", "", ER_SP_CURSOR_AFTER_HANDLER, "42000", "",
ER_SP_CASE_NOT_FOUND, "20000", "", ER_SP_CASE_NOT_FOUND, "20000", "",
ER_DIVISION_BY_ZERO, "22012", "", ER_DIVISION_BY_ZERO, "22012", "",
ER_ILLEGAL_VALUE_FOR_TYPE, "22007", "",

View File

@ -463,7 +463,7 @@ ALTER TABLE t1 DROP PRIMARY KEY;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) default NULL, `b` int(11) default NULL,
UNIQUE KEY `b` (`b`) UNIQUE KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1

View File

@ -232,7 +232,7 @@ a b
delete from t1 where a=0; delete from t1 where a=0;
update t1 set a=NULL where b=6; update t1 set a=NULL where b=6;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 4 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4
update t1 set a=300 where b=7; update t1 set a=300 where b=7;
SET SQL_MODE=''; SET SQL_MODE='';
insert into t1(a,b)values(NULL,8); insert into t1(a,b)values(NULL,8);
@ -274,7 +274,7 @@ a b
delete from t1 where a=0; delete from t1 where a=0;
update t1 set a=NULL where b=13; update t1 set a=NULL where b=13;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 9 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 9
update t1 set a=500 where b=14; update t1 set a=500 where b=14;
select * from t1 order by b; select * from t1 order by b;
a b a b

View File

@ -11,7 +11,7 @@ create table t1 (b char(0) not null);
create table if not exists t1 (b char(0) not null); create table if not exists t1 (b char(0) not null);
insert into t1 values (""),(null); insert into t1 values (""),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
select * from t1; select * from t1;
b b
@ -152,7 +152,7 @@ create table t1 (a int not null, b int, primary key(a), key (b), key (b), key (b
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) default NULL, `b` int(11) default NULL,
PRIMARY KEY (`a`), PRIMARY KEY (`a`),
KEY `b` (`b`), KEY `b` (`b`),
@ -203,7 +203,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION storage_engine="gemini"; SET SESSION storage_engine="gemini";
@ -215,7 +215,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION storage_engine=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;
@ -291,7 +291,7 @@ create table t3 like t1;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3; select * from t3;
@ -306,7 +306,7 @@ create temporary table t3 like t2;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TEMPORARY TABLE `t3` ( t3 CREATE TEMPORARY TABLE `t3` (
`id` int(11) NOT NULL default '0' `id` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3; select * from t3;
id id
@ -314,7 +314,7 @@ drop table t3;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t3; select * from t3;
@ -326,14 +326,14 @@ create temporary table t3 like mysqltest.t3;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TEMPORARY TABLE `t3` ( t3 CREATE TEMPORARY TABLE `t3` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
create table t2 like t3; create table t2 like t3;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`name` char(20) default NULL `name` char(20) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2; select * from t2;
@ -360,7 +360,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
drop table t1; drop table t1;
SET SESSION storage_engine="gemini"; SET SESSION storage_engine="gemini";
@ -372,7 +372,7 @@ CREATE TABLE t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=HEAP DEFAULT CHARSET=latin1 ) ENGINE=HEAP DEFAULT CHARSET=latin1
SET SESSION storage_engine=default; SET SESSION storage_engine=default;
drop table t1; drop table t1;

View File

@ -484,7 +484,7 @@ ERROR HY000: Unknown collation: 'koi8r'
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`latin1_f` char(32) NOT NULL default '' `latin1_f` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW FIELDS FROM t1; SHOW FIELDS FROM t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra

View File

@ -224,8 +224,8 @@ create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`word` varchar(255) collate latin1_german2_ci NOT NULL default '', `word` varchar(255) collate latin1_german2_ci NOT NULL,
`word2` varchar(255) collate latin1_german2_ci NOT NULL default '', `word2` varchar(255) collate latin1_german2_ci NOT NULL,
KEY `word` (`word`) KEY `word` (`word`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');

View File

@ -7,40 +7,40 @@ koi8_ru_f CHAR(32) CHARACTER SET koi8r NOT NULL
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`comment` char(32) character set latin1 NOT NULL default '', `comment` char(32) character set latin1 NOT NULL,
`koi8_ru_f` char(32) character set koi8r NOT NULL default '' `koi8_ru_f` char(32) character set koi8r NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin5 ) ENGINE=MyISAM DEFAULT CHARSET=latin5
ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL; ALTER TABLE t1 CHANGE comment comment CHAR(32) CHARACTER SET latin2 NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`comment` char(32) character set latin2 NOT NULL default '', `comment` char(32) character set latin2 NOT NULL,
`koi8_ru_f` char(32) character set koi8r NOT NULL default '' `koi8_ru_f` char(32) character set koi8r NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin5 ) ENGINE=MyISAM DEFAULT CHARSET=latin5
ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL; ALTER TABLE t1 ADD latin5_f CHAR(32) NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`comment` char(32) character set latin2 NOT NULL default '', `comment` char(32) character set latin2 NOT NULL,
`koi8_ru_f` char(32) character set koi8r NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL,
`latin5_f` char(32) NOT NULL default '' `latin5_f` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin5 ) ENGINE=MyISAM DEFAULT CHARSET=latin5
ALTER TABLE t1 DEFAULT CHARSET=latin2; ALTER TABLE t1 DEFAULT CHARSET=latin2;
ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL; ALTER TABLE t1 ADD latin2_f CHAR(32) NOT NULL;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`comment` char(32) NOT NULL default '', `comment` char(32) NOT NULL,
`koi8_ru_f` char(32) character set koi8r NOT NULL default '', `koi8_ru_f` char(32) character set koi8r NOT NULL,
`latin5_f` char(32) character set latin5 NOT NULL default '', `latin5_f` char(32) character set latin5 NOT NULL,
`latin2_f` char(32) NOT NULL default '' `latin2_f` char(32) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2 ) ENGINE=MyISAM DEFAULT CHARSET=latin2
ALTER TABLE t1 DROP latin2_f, DROP latin5_f; ALTER TABLE t1 DROP latin2_f, DROP latin5_f;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`comment` char(32) NOT NULL default '', `comment` char(32) NOT NULL,
`koi8_ru_f` char(32) character set koi8r NOT NULL default '' `koi8_ru_f` char(32) character set koi8r NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2 ) ENGINE=MyISAM DEFAULT CHARSET=latin2
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('a','LAT SMALL A');
INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B'); INSERT INTO t1 (koi8_ru_f,comment) VALUES ('b','LAT SMALL B');

View File

@ -50,7 +50,7 @@ Tables_in_test table_type
SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
Table Create Table Table Create Table
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` ( <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` (
`<60><><EFBFBD><EFBFBD>` char(32) character set koi8r NOT NULL default '' COMMENT '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>' `<60><><EFBFBD><EFBFBD>` char(32) character set koi8r NOT NULL COMMENT '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
SHOW FIELDS FROM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; SHOW FIELDS FROM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
Field Type Null Key Default Extra Field Type Null Key Default Extra
@ -62,7 +62,7 @@ Tables_in_test table_type
SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; SHOW CREATE TABLE <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
Table Create Table Table Create Table
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` ( <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> CREATE TABLE `<60><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>` (
`<60><><EFBFBD><EFBFBD>` char(32) character set koi8r NOT NULL default '' COMMENT '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>' `<60><><EFBFBD><EFBFBD>` char(32) character set koi8r NOT NULL COMMENT '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'
SHOW FIELDS FROM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; SHOW FIELDS FROM <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>;
Field Type Null Key Default Extra Field Type Null Key Default Extra
@ -74,7 +74,7 @@ Tables_in_test table_type
SHOW CREATE TABLE таблица; SHOW CREATE TABLE таблица;
Table Create Table Table Create Table
таблица CREATE TABLE `таблица` ( таблица CREATE TABLE `таблица` (
`поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий поля' `поле` char(32) character set koi8r NOT NULL COMMENT 'комментарий поля'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица; SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra Field Type Null Key Default Extra

View File

@ -8,7 +8,7 @@ SHOW CREATE TABLE t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`fid` int(11) NOT NULL auto_increment, `fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL default '', `g` geometry NOT NULL,
PRIMARY KEY (`fid`), PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32)) SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
@ -291,7 +291,7 @@ SHOW CREATE TABLE t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`fid` int(11) NOT NULL auto_increment, `fid` int(11) NOT NULL auto_increment,
`g` geometry NOT NULL default '', `g` geometry NOT NULL,
PRIMARY KEY (`fid`), PRIMARY KEY (`fid`),
SPATIAL KEY `g` (`g`(32)) SPATIAL KEY `g` (`g`(32))
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1

View File

@ -9,35 +9,35 @@ CREATE TABLE gis_geometrycollection (fid INTEGER NOT NULL PRIMARY KEY, g GEOMET
CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY); CREATE TABLE gis_geometry (fid INTEGER NOT NULL PRIMARY KEY, g GEOMETRY);
SHOW FIELDS FROM gis_point; SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g point YES NULL g point YES NULL
SHOW FIELDS FROM gis_line; SHOW FIELDS FROM gis_line;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g linestring YES NULL g linestring YES NULL
SHOW FIELDS FROM gis_polygon; SHOW FIELDS FROM gis_polygon;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g polygon YES NULL g polygon YES NULL
SHOW FIELDS FROM gis_multi_point; SHOW FIELDS FROM gis_multi_point;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g multipoint YES NULL g multipoint YES NULL
SHOW FIELDS FROM gis_multi_line; SHOW FIELDS FROM gis_multi_line;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g multilinestring YES NULL g multilinestring YES NULL
SHOW FIELDS FROM gis_multi_polygon; SHOW FIELDS FROM gis_multi_polygon;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g multipolygon YES NULL g multipolygon YES NULL
SHOW FIELDS FROM gis_geometrycollection; SHOW FIELDS FROM gis_geometrycollection;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g geometrycollection YES NULL g geometrycollection YES NULL
SHOW FIELDS FROM gis_geometry; SHOW FIELDS FROM gis_geometry;
Field Type Null Key Default Extra Field Type Null Key Default Extra
fid int(11) PRI 0 fid int(11) PRI
g geometry YES NULL g geometry YES NULL
INSERT INTO gis_point VALUES INSERT INTO gis_point VALUES
(101, PointFromText('POINT(10 10)')), (101, PointFromText('POINT(10 10)')),
@ -430,7 +430,7 @@ mln multilinestring YES NULL
mpg multipolygon YES NULL mpg multipolygon YES NULL
gc geometrycollection YES NULL gc geometrycollection YES NULL
gm geometry YES NULL gm geometry YES NULL
fid int(11) 0 fid int(11)
DROP TABLE t1; DROP TABLE t1;
SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))); SELECT AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))));
AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)')))) AsText(GeometryFromWKB(AsWKB(GeometryFromText('POINT(1 4)'))))

View File

@ -1460,14 +1460,14 @@ create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) ref
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`) UNIQUE KEY `id` (`id`,`id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `t1_id_fk` (`id`), KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
@ -1475,7 +1475,7 @@ create index id on t2 (id);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `id` (`id`), KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
@ -1483,7 +1483,7 @@ create index id2 on t2 (id);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `id` (`id`), KEY `id` (`id`),
KEY `id2` (`id`), KEY `id2` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
@ -1494,7 +1494,7 @@ Got one of the listed errors
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
KEY `id` (`id`), KEY `id` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
@ -1503,8 +1503,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`,`id2`), KEY `t1_id_fk` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
@ -1512,8 +1512,8 @@ create unique index id on t2 (id,id2);
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
@ -1522,8 +1522,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`), KEY `t1_id_fk` (`id2`,`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
@ -1533,8 +1533,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), con
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
@ -1543,8 +1543,8 @@ create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),cons
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL default '0', `id` int(11) NOT NULL,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
UNIQUE KEY `id` (`id`,`id2`), UNIQUE KEY `id` (`id`,`id2`),
KEY `t1_id_fk` (`id2`,`id`), KEY `t1_id_fk` (`id2`,`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
@ -1555,7 +1555,7 @@ show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `id` (`id`,`id2`), KEY `id` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
@ -1566,7 +1566,7 @@ show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
KEY `t1_id_fk` (`id`), KEY `t1_id_fk` (`id`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
@ -1575,7 +1575,7 @@ show create table t2;
Table Create Table Table Create Table
t2 CREATE TABLE `t2` ( t2 CREATE TABLE `t2` (
`id` int(11) NOT NULL auto_increment, `id` int(11) NOT NULL auto_increment,
`id2` int(11) NOT NULL default '0', `id2` int(11) NOT NULL,
KEY `id_test` (`id`), KEY `id_test` (`id`),
KEY `id_test2` (`id`,`id2`), KEY `id_test2` (`id`,`id2`),
CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`) CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)

View File

@ -63,7 +63,7 @@ insert into t1 values(NULL);
ERROR 23000: Column 'id' cannot be null ERROR 23000: Column 'id' cannot be null
insert into t1 values (1), (NULL), (2); insert into t1 values (1), (NULL), (2);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id' at row 2
select * from t1; select * from t1;
id id
1 1
@ -157,19 +157,19 @@ f_float_3_1_u 0.0
set @value= "1e+1111111111a"; set @value= "1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1 Warning 1264 Out of range value adjusted for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 4 number 4
@ -185,20 +185,20 @@ f_float_3_1_u 99.9
set @value= "-1e+1111111111a"; set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
Warning 1265 Data truncated for column 'f_double' at row 1 Warning 1264 Out of range value adjusted for column 'f_double' at row 1
Warning 1265 Data truncated for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_float' at row 1 Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1265 Data truncated for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1265 Data truncated for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1265 Data truncated for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1265 Data truncated for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1265 Data truncated for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1265 Data truncated for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 5 number 5
@ -212,46 +212,9 @@ f_float_u 0
f_double_15_1_u 0.0 f_double_15_1_u 0.0
f_float_3_1_u 0.0 f_float_3_1_u 0.0
set @value= 1e+1111111111; set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); ERROR 22007: Illegal double '1e+1111111111' value found during parsing
Warnings:
Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 6
original_value 1.7976931348623e+308
f_double 1.79769313486232e+308
f_float 3.40282e+38
f_double_7_2 99999.99
f_float_4_3 9.999
f_double_u 1.79769313486232e+308
f_float_u 3.40282e+38
f_double_15_1_u 99999999999999.9
f_float_3_1_u 99.9
set @value= -1e+1111111111; set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); ERROR 22007: Illegal double '1e+1111111111' value found during parsing
Warnings:
Warning 1264 Out of range value adjusted for column 'f_float' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_7_2' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_4_3' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id();
number 7
original_value -1.7976931348623e+308
f_double -1.79769313486232e+308
f_float -3.40282e+38
f_double_7_2 -99999.99
f_float_4_3 -9.999
f_double_u 0
f_float_u 0
f_double_15_1_u 0.0
f_float_3_1_u 0.0
set @value= 1e+111; set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
Warnings: Warnings:
@ -262,7 +225,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 8 number 6
original_value 1e+111 original_value 1e+111
f_double 1e+111 f_double 1e+111
f_float 3.40282e+38 f_float 3.40282e+38
@ -283,7 +246,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 9 number 7
original_value -1e+111 original_value -1e+111
f_double -1e+111 f_double -1e+111
f_float -3.40282e+38 f_float -3.40282e+38
@ -296,7 +259,7 @@ f_float_3_1_u 0.0
set @value= 1; set @value= 1;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 10 number 8
original_value 1 original_value 1
f_double 1 f_double 1
f_float 1 f_float 1
@ -314,7 +277,7 @@ Warning 1264 Out of range value adjusted for column 'f_float_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_double_15_1_u' at row 1
Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1 Warning 1264 Out of range value adjusted for column 'f_float_3_1_u' at row 1
select * from t1 where number =last_insert_id(); select * from t1 where number =last_insert_id();
number 11 number 9
original_value -1 original_value -1
f_double -1 f_double -1
f_float -1 f_float -1

View File

@ -622,8 +622,8 @@ NULL 2 100
create table t2(No int not null, Field int not null, Count int not null); create table t2(No int not null, Field int not null, Count int not null);
insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2; insert into t2 Select null, Field, Count From t1 Where Month=20030901 and Type=2;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'No' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'No' at row 2
select * from t2; select * from t2;
No Field Count No Field Count
0 1 100 0 1 100

View File

@ -65,14 +65,14 @@ test.t2 check error Table 't2' was not locked with LOCK TABLES
test.t1 check status OK test.t1 check status OK
show columns from t1; show columns from t1;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) PRI 0 a int(11) PRI
b int(11) MUL 0 b int(11) MUL
c int(11) 0 c int(11)
show full columns from t1; show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
a int(11) NULL PRI 0 select,insert,update,references a int(11) NULL PRI select,insert,update,references
b int(11) NULL MUL 0 select,insert,update,references b int(11) NULL MUL select,insert,update,references
c int(11) NULL 0 select,insert,update,references c int(11) NULL select,insert,update,references
show index from t1; show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 4 NULL NULL BTREE t1 0 PRIMARY 1 a A 4 NULL NULL BTREE

View File

@ -159,8 +159,8 @@ CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i)); UNIQUE (c,i));
INSERT INTO t1 (c) VALUES (NULL),(NULL); INSERT INTO t1 (c) VALUES (NULL),(NULL);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2
SELECT * FROM t1; SELECT * FROM t1;
c i c i
1 1

View File

@ -172,7 +172,7 @@ a b
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` char(20) default NULL, `b` char(20) default NULL,
KEY `a` (`a`) KEY `a` (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
@ -187,7 +187,7 @@ create table t5 (a int not null, b char(20), key(a)) engine=MERGE UNION=(test.t1
show create table t5; show create table t5;
Table Create Table Table Create Table
t5 CREATE TABLE `t5` ( t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` char(20) default NULL, `b` char(20) default NULL,
KEY `a` (`a`) KEY `a` (`a`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`mysqltest`.`t6`)
@ -260,16 +260,16 @@ ENGINE=MERGE UNION=(t1,t2);
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0', `incr` int(11) NOT NULL,
`othr` int(11) NOT NULL default '0', `othr` int(11) NOT NULL,
PRIMARY KEY (`incr`) PRIMARY KEY (`incr`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
alter table t3 drop primary key; alter table t3 drop primary key;
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`incr` int(11) NOT NULL default '0', `incr` int(11) NOT NULL,
`othr` int(11) NOT NULL default '0' `othr` int(11) NOT NULL
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
drop table t3,t2,t1; drop table t3,t2,t1;
create table t1 (a int not null, key(a)) engine=merge; create table t1 (a int not null, key(a)) engine=merge;
@ -296,28 +296,28 @@ create table t6 (a int not null, b int not null auto_increment, primary key(a,b)
show create table t3; show create table t3;
Table Create Table Table Create Table
t3 CREATE TABLE `t3` ( t3 CREATE TABLE `t3` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`)
show create table t5; show create table t5;
Table Create Table Table Create Table
t5 CREATE TABLE `t5` ( t5 CREATE TABLE `t5` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL auto_increment, `b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`)
show create table t6; show create table t6;
Table Create Table Table Create Table
t6 CREATE TABLE `t6` ( t6 CREATE TABLE `t6` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL auto_increment, `b` int(11) NOT NULL auto_increment,
PRIMARY KEY (`a`,`b`) PRIMARY KEY (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=LAST UNION=(`t1`,`t2`)
@ -382,8 +382,8 @@ alter table t4 UNION=(t1,t2,t3);
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 UNION=(`t1`,`t2`,`t3`)
select * from t4 order by a,b; select * from t4 order by a,b;
@ -408,8 +408,8 @@ alter table t4 INSERT_METHOD=FIRST;
show create table t4; show create table t4;
Table Create Table Table Create Table
t4 CREATE TABLE `t4` ( t4 CREATE TABLE `t4` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` int(11) NOT NULL default '0', `b` int(11) NOT NULL,
KEY `a` (`a`,`b`) KEY `a` (`a`,`b`)
) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`) ) ENGINE=MRG_MyISAM DEFAULT CHARSET=latin1 INSERT_METHOD=FIRST UNION=(`t1`,`t2`,`t3`)
insert into t4 values (4,1),(4,2); insert into t4 values (4,1),(4,2);

View File

@ -97,39 +97,39 @@ Warnings:
Warning 1265 Data truncated for column 'd' at row 1 Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL; UPDATE t1 SET d=NULL;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1
INSERT INTO t1 (a) values (null); INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null); INSERT INTO t1 (a) values (1/null);
ERROR 23000: Column 'a' cannot be null ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (null),(null); INSERT INTO t1 (a) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2
INSERT INTO t1 (b) values (null); INSERT INTO t1 (b) values (null);
ERROR 23000: Column 'b' cannot be null ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (1/null); INSERT INTO t1 (b) values (1/null);
ERROR 23000: Column 'b' cannot be null ERROR 23000: Column 'b' cannot be null
INSERT INTO t1 (b) values (null),(null); INSERT INTO t1 (b) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
INSERT INTO t1 (c) values (null); INSERT INTO t1 (c) values (null);
ERROR 23000: Column 'c' cannot be null ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (1/null); INSERT INTO t1 (c) values (1/null);
ERROR 23000: Column 'c' cannot be null ERROR 23000: Column 'c' cannot be null
INSERT INTO t1 (c) values (null),(null); INSERT INTO t1 (c) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'c' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'c' at row 2
INSERT INTO t1 (d) values (null); INSERT INTO t1 (d) values (null);
ERROR 23000: Column 'd' cannot be null ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (1/null); INSERT INTO t1 (d) values (1/null);
ERROR 23000: Column 'd' cannot be null ERROR 23000: Column 'd' cannot be null
INSERT INTO t1 (d) values (null),(null); INSERT INTO t1 (d) values (null),(null);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 1
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'd' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'd' at row 2
select * from t1; select * from t1;
a b c d a b c d
0 0000-00-00 00:00:00 0 0 0000-00-00 00:00:00 0

View File

@ -342,7 +342,7 @@ index (id2)
); );
insert into t1 values(null,null),(1,1); insert into t1 values(null,null),(1,1);
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'id2' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'id2' at row 1
select * from t1; select * from t1;
id id2 id id2
NULL 0 NULL 0

View File

@ -257,7 +257,7 @@ t2 BASE TABLE
prepare stmt4 from ' show columns from t2 from test like ''a%'' '; prepare stmt4 from ' show columns from t2 from test like ''a%'' ';
execute stmt4; execute stmt4;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) PRI 0 a int(11) PRI
create index t2_idx on t2(b); create index t2_idx on t2(b);
prepare stmt4 from ' show index from t2 from test '; prepare stmt4 from ' show index from t2 from test ';
execute stmt4; execute stmt4;
@ -355,7 +355,7 @@ drop user drop_user@localhost;
prepare stmt3 from ' describe t2 '; prepare stmt3 from ' describe t2 ';
execute stmt3; execute stmt3;
Field Type Null Key Default Extra Field Type Null Key Default Extra
a int(11) PRI 0 a int(11) PRI
b char(10) YES MUL NULL b char(10) YES MUL NULL
drop table t2 ; drop table t2 ;
execute stmt3; execute stmt3;

View File

@ -1,4 +1,5 @@
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
drop view if exists v1;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL

View File

@ -77,13 +77,13 @@ create temporary table t1 (a int not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TEMPORARY TABLE `t1` ( t1 CREATE TEMPORARY TABLE `t1` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t1 rename t2; alter table t1 rename t2;
show create table t2; show create table t2;
Table Create Table Table Create Table
t2 CREATE TEMPORARY TABLE `t2` ( t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) NOT NULL default '0' `a` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t2; drop table t2;
create table t1 ( create table t1 (
@ -98,7 +98,7 @@ Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`test_set` set('val1','val2','val3') NOT NULL default '', `test_set` set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
`c` int(11) NOT NULL default '0' COMMENT 'int column', `c` int(11) NOT NULL COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a minus', `c-b` int(11) default NULL COMMENT 'name with a minus',
`space 2` int(11) default NULL COMMENT 'name with a space' `space 2` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
@ -108,7 +108,7 @@ Table Create Table
t1 CREATE TABLE t1 ( t1 CREATE TABLE t1 (
test_set set('val1','val2','val3') NOT NULL default '', test_set set('val1','val2','val3') NOT NULL default '',
`name` char(20) default 'O''Brien' COMMENT 'O''Brien as default', `name` char(20) default 'O''Brien' COMMENT 'O''Brien as default',
c int(11) NOT NULL default '0' COMMENT 'int column', c int(11) NOT NULL COMMENT 'int column',
`c-b` int(11) default NULL COMMENT 'name with a minus', `c-b` int(11) default NULL COMMENT 'name with a minus',
`space 2` int(11) default NULL COMMENT 'name with a space' `space 2` int(11) default NULL COMMENT 'name with a space'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='it''s a table'
@ -117,7 +117,7 @@ show full columns from t1;
Field Type Collation Null Key Default Extra Privileges Comment Field Type Collation Null Key Default Extra Privileges Comment
test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references test_set set('val1','val2','val3') latin1_swedish_ci select,insert,update,references
name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default name char(20) latin1_swedish_ci YES O'Brien select,insert,update,references O'Brien as default
c int(11) NULL 0 select,insert,update,references int column c int(11) NULL select,insert,update,references int column
c-b int(11) NULL YES NULL select,insert,update,references name with a minus c-b int(11) NULL YES NULL select,insert,update,references name with a minus
space 2 int(11) NULL YES NULL select,insert,update,references name with a space space 2 int(11) NULL YES NULL select,insert,update,references name with a space
drop table t1; drop table t1;
@ -125,7 +125,7 @@ create table t1 (a int not null, unique aa (a));
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
UNIQUE KEY `aa` (`a`) UNIQUE KEY `aa` (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
@ -133,7 +133,7 @@ create table t1 (a int not null, primary key (a));
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
PRIMARY KEY (`a`) PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
@ -150,7 +150,7 @@ create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CH
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` char(10) default NULL, `b` char(10) default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=100 AVG_ROW_LENGTH=10 PACK_KEYS=1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=FIXED COMMENT='test'
@ -158,7 +158,7 @@ alter table t1 MAX_ROWS=200 ROW_FORMAT=dynamic PACK_KEYS=0;
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` varchar(10) default NULL, `b` varchar(10) default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test' ) ENGINE=MyISAM DEFAULT CHARSET=latin1 MIN_ROWS=10 MAX_ROWS=200 AVG_ROW_LENGTH=10 PACK_KEYS=0 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC COMMENT='test'
@ -166,7 +166,7 @@ ALTER TABLE t1 AVG_ROW_LENGTH=0 CHECKSUM=0 COMMENT="" MIN_ROWS=0 MAX_ROWS=0 PACK
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL default '0', `a` int(11) NOT NULL,
`b` varchar(10) default NULL, `b` varchar(10) default NULL,
KEY `b` (`b`) KEY `b` (`b`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
@ -216,7 +216,7 @@ index(type_short)
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`type_bool` tinyint(1) NOT NULL default '0', `type_bool` tinyint(1) NOT NULL,
`type_tiny` tinyint(4) NOT NULL auto_increment, `type_tiny` tinyint(4) NOT NULL auto_increment,
`type_short` smallint(3) default NULL, `type_short` smallint(3) default NULL,
`type_mediumint` mediumint(9) default NULL, `type_mediumint` mediumint(9) default NULL,
@ -227,9 +227,9 @@ t1 CREATE TABLE `t1` (
`type_char` char(2) default NULL, `type_char` char(2) default NULL,
`type_varchar` varchar(10) default NULL, `type_varchar` varchar(10) default NULL,
`type_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `type_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`type_date` date NOT NULL default '0000-00-00', `type_date` date NOT NULL,
`type_time` time NOT NULL default '00:00:00', `type_time` time NOT NULL,
`type_datetime` datetime NOT NULL default '0000-00-00 00:00:00', `type_datetime` datetime NOT NULL,
`type_year` year(4) default NULL, `type_year` year(4) default NULL,
`type_enum` enum('red','green','blue') default NULL, `type_enum` enum('red','green','blue') default NULL,
`type_set` enum('red','green','blue') default NULL, `type_set` enum('red','green','blue') default NULL,

View File

@ -1620,8 +1620,8 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer
tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` char(16) NOT NULL default '', `id` char(16) NOT NULL,
`data` int(11) NOT NULL default '0' `data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
@ -1629,7 +1629,7 @@ Database (foo)
Level Code Message Level Code Message
Field Type Null Key Default Extra Field Type Null Key Default Extra
id char(16) id char(16)
data int(11) 0 data int(11)
Grants for root@localhost Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
@ -1670,8 +1670,8 @@ tinyint 1 -128 127 0 0 YES YES NO YES YES NO NULL,0 A very small integer
tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer tinyint unsigned 1 0 255 0 0 YES YES YES YES YES NO NULL,0 A very small integer
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`id` char(16) NOT NULL default '', `id` char(16) NOT NULL,
`data` int(11) NOT NULL default '0' `data` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
Database Create Database Database Create Database
test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */ test CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET latin1 */
@ -1679,7 +1679,7 @@ Database (foo)
Level Code Message Level Code Message
Field Type Null Key Default Extra Field Type Null Key Default Extra
id char(16) id char(16)
data int(11) 0 data int(11)
Grants for root@localhost Grants for root@localhost
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment

View File

@ -60,7 +60,7 @@ col1
0000-00-00 0000-00-00
0000-00-00 0000-00-00
drop table t1; drop table t1;
set @@sql_mode="strict_trans_tables"; set @@sql_mode='strict_trans_tables';
CREATE TABLE t1 (col1 date) engine=myisam; CREATE TABLE t1 (col1 date) engine=myisam;
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1'); INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1
@ -87,7 +87,7 @@ col1
0000-00-00 0000-00-00
2003-02-31 2003-02-31
drop table t1; drop table t1;
set @@sql_mode="strict_trans_tables"; set @@sql_mode='strict_trans_tables';
CREATE TABLE t1 (col1 date) engine=innodb; CREATE TABLE t1 (col1 date) engine=innodb;
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1'); INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1 ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1
@ -676,3 +676,207 @@ NULL
999.99 999.99
-99.99 -99.99
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (col1 FLOAT, col2 FLOAT UNSIGNED);
INSERT INTO t1 VALUES (-1.1E-38,0),(+3.4E+38,+3.4E+38);
INSERT INTO t1 VALUES ('-1.1E-38',0),('+3.4E+38','+3.4E+38');
INSERT INTO t1 (col1) VALUES (3E-46);
INSERT INTO t1 (col1) VALUES (+3.4E+39);
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES (-1.1E-3);
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES ('+3.4E+39');
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('-1.1E-3');
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
ERROR 22003: Out of range value adjusted for column 'col1' at row 2
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES (1/0);
Warnings:
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES (+3.4E+39,-3.4E+39);
Warnings:
Warning 1264 Out of range value adjusted for column 'col1' at row 1
Warning 1264 Out of range value adjusted for column 'col2' at row 1
INSERT IGNORE INTO t1 VALUES ('+3.4E+39','-3.4E+39');
Warnings:
Warning 1264 Out of range value adjusted for column 'col1' at row 1
Warning 1264 Out of range value adjusted for column 'col2' at row 1
SELECT * FROM t1;
col1 col2
-1.1e-38 0
3.4e+38 3.4e+38
-1.1e-38 0
3.4e+38 3.4e+38
0 NULL
2 NULL
NULL NULL
3.40282e+38 0
3.40282e+38 0
DROP TABLE t1;
CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED);
INSERT INTO t1 VALUES (-2.2E-308,0),(+1.7E+308,+1.7E+308);
INSERT INTO t1 VALUES ('-2.2E-308',0),('+1.7E+308','+1.7E+308');
INSERT INTO t1 (col1) VALUES (-2.2E-330);
INSERT INTO t1 (col1) VALUES (+1.7E+309);
ERROR 22007: Illegal double '1.7E+309' value found during parsing
INSERT INTO t1 (col2) VALUES (-1.1E-3);
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
INSERT INTO t1 (col1) VALUES ('+1.8E+309');
ERROR 22003: Out of range value adjusted for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
ERROR 22003: Out of range value adjusted for column 'col2' at row 1
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
ERROR 22003: Out of range value adjusted for column 'col1' at row 2
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
ERROR 22012: Division by 0
SELECT MOD(col1,0) FROM t1;
ERROR 22012: Division by 0
INSERT INTO t1 (col1) VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('a59b');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('1a');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
INSERT IGNORE INTO t1 (col1) values (1/0);
Warnings:
Error 1365 Division by 0
INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309);
ERROR 22007: Illegal double '1.9E+309' value found during parsing
INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309');
Warnings:
Warning 1264 Out of range value adjusted for column 'col1' at row 1
Warning 1264 Out of range value adjusted for column 'col2' at row 1
Warning 1264 Out of range value adjusted for column 'col2' at row 1
SELECT * FROM t1;
col1 col2
-2.2e-308 0
1.7e+308 1.7e+308
-2.2e-308 0
1.7e+308 1.7e+308
-0 NULL
2 NULL
NULL NULL
1.79769313486232e+308 0
DROP TABLE t1;
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(5));
INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');
INSERT INTO t1 (col1) VALUES ('hellobob');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col2) VALUES ('hellobob');
ERROR 01000: Data truncated for column 'col2' at row 1
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
ERROR 01000: Data truncated for column 'col1' at row 2
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
ERROR 01000: Data truncated for column 'col2' at row 2
INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
Warning 1265 Data truncated for column 'col2' at row 1
UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he';
Warnings:
Warning 1265 Data truncated for column 'col2' at row 2
SELECT * FROM t1;
col1 col2
hello hello
he hello
hello hello
hello hello
DROP TABLE t1;
CREATE TABLE t1 (col1 enum('red','blue','green'));
INSERT INTO t1 VALUES ('red'),('blue'),('green');
INSERT INTO t1 (col1) VALUES ('yellow');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES ('redd');
ERROR 01000: Data truncated for column 'col1' at row 1
INSERT INTO t1 VALUES ('');
ERROR 01000: Data truncated for column 'col1' at row 1
UPDATE t1 SET col1 ='yellow' WHERE col1 ='green';
ERROR 01000: Data truncated for column 'col1' at row 3
INSERT IGNORE INTO t1 VALUES ('yellow');
Warnings:
Warning 1265 Data truncated for column 'col1' at row 1
UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';
Warnings:
Warning 1265 Data truncated for column 'col1' at row 2
SELECT * FROM t1;
col1
red
green
DROP TABLE t1;
CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);
INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');
INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');
INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
ERROR 23000: Column 'col1' cannot be null
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
ERROR 23000: Column 'col2' cannot be null
INSERT INTO t1 VALUES (103,'',NULL);
ERROR 23000: Column 'col3' cannot be null
UPDATE t1 SET col1=NULL WHERE col1 =100;
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col3' at row 1
SELECT * FROM t1;
col1 col2 col3
100 hello 2004-08-20
101 hell2 2004-08-21
0 0000-00-00
DROP TABLE t1;
CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE "t1" (
"col1" int(11) NOT NULL default '99',
"col2" char(6) NOT NULL
)
INSERT INTO t1 VALUES (1, 'hello');
INSERT INTO t1 (col2) VALUES ('hello2');
INSERT INTO t1 (col2) VALUES (NULL);
ERROR 23000: Column 'col2' cannot be null
INSERT INTO t1 (col1) VALUES (2);
ERROR HY000: Field 'col2' doesn't have a default value
INSERT INTO t1 VALUES(default(col1),default(col2));
ERROR HY000: Field 'col2' doesn't have a default value
INSERT INTO t1 (col1) SELECT 1;
ERROR HY000: Field 'col2' doesn't have a default value
INSERT INTO t1 SELECT 1,NULL;
ERROR 22004: Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
INSERT IGNORE INTO t1 values (NULL,NULL);
Warnings:
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col1' at row 1
Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'col2' at row 1
INSERT IGNORE INTO t1 (col1) values (3);
INSERT IGNORE INTO t1 () values ();
SELECT * FROM t1;
col1 col2
1 hello
99 hello2
0
3
99
DROP TABLE t1;

View File

@ -3,7 +3,7 @@ create table t1 (a set (' ','a','b') not null);
show create table t1; show create table t1;
Table Create Table Table Create Table
t1 CREATE TABLE `t1` ( t1 CREATE TABLE `t1` (
`a` set('','a','b') NOT NULL default '' `a` set('','a','b') NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1; drop table t1;
create table t1 (a set (' ','a','b ') not null default 'b '); create table t1 (a set (' ','a','b ') not null default 'b ');

View File

@ -43,7 +43,7 @@ drop table t1;
create table t1(a tinyint, b int not null, c date, d char(5)); create table t1(a tinyint, b int not null, c date, d char(5));
load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ','; load data infile '../../std_data/warnings_loaddata.dat' into table t1 fields terminated by ',';
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'b' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'b' at row 2
Warning 1265 Data truncated for column 'd' at row 3 Warning 1265 Data truncated for column 'd' at row 3
Warning 1265 Data truncated for column 'c' at row 4 Warning 1265 Data truncated for column 'c' at row 4
Warning 1261 Row 5 doesn't contain data for all columns Warning 1261 Row 5 doesn't contain data for all columns
@ -57,7 +57,7 @@ drop table t1;
create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5)); create table t1(a tinyint NOT NULL, b tinyint unsigned, c char(5));
insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test'); insert into t1 values(NULL,100,'mysql'),(10,-1,'mysql ab'),(500,256,'open source'),(20,NULL,'test');
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 1 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 1
Warning 1264 Out of range value adjusted for column 'b' at row 2 Warning 1264 Out of range value adjusted for column 'b' at row 2
Warning 1265 Data truncated for column 'c' at row 2 Warning 1265 Data truncated for column 'c' at row 2
Warning 1264 Out of range value adjusted for column 'a' at row 3 Warning 1264 Out of range value adjusted for column 'a' at row 3
@ -70,7 +70,7 @@ Warning 1265 Data truncated for column 'c' at row 2
alter table t1 add d char(2); alter table t1 add d char(2);
update t1 set a=NULL where a=10; update t1 set a=NULL where a=10;
Warnings: Warnings:
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 2 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 2
update t1 set c='mysql ab' where c='test'; update t1 set c='mysql ab' where c='test';
Warnings: Warnings:
Warning 1265 Data truncated for column 'c' at row 4 Warning 1265 Data truncated for column 'c' at row 4
@ -86,7 +86,7 @@ Warnings:
Warning 1265 Data truncated for column 'b' at row 1 Warning 1265 Data truncated for column 'b' at row 1
Warning 1265 Data truncated for column 'b' at row 2 Warning 1265 Data truncated for column 'b' at row 2
Warning 1265 Data truncated for column 'b' at row 3 Warning 1265 Data truncated for column 'b' at row 3
Warning 1263 Data truncated; NULL supplied to NOT NULL column 'a' at row 4 Warning 1263 Column set to default value; NULL supplied to NOT NULL column 'a' at row 4
Warning 1265 Data truncated for column 'b' at row 4 Warning 1265 Data truncated for column 'b' at row 4
insert into t2(b) values('mysqlab'); insert into t2(b) values('mysqlab');
Warnings: Warnings:

View File

@ -115,13 +115,10 @@ set @value= "-1e+1111111111a";
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id() --query_vertical select * from t1 where number =last_insert_id()
--error 1367
set @value= 1e+1111111111; set @value= 1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); --error 1367
--query_vertical select * from t1 where number =last_insert_id()
set @value= -1e+1111111111; set @value= -1e+1111111111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);
--query_vertical select * from t1 where number =last_insert_id()
set @value= 1e+111; set @value= 1e+111;
insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); insert into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value);

View File

@ -8,6 +8,7 @@
--disable_warnings --disable_warnings
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
drop view if exists v1;
--enable_warnings --enable_warnings
CREATE TABLE t1 ( CREATE TABLE t1 (

View File

@ -58,7 +58,7 @@ drop table t1;
# Test difference in behaviour with InnoDB and MyISAM tables # Test difference in behaviour with InnoDB and MyISAM tables
set @@sql_mode="strict_trans_tables"; set @@sql_mode='strict_trans_tables';
CREATE TABLE t1 (col1 date) engine=myisam; CREATE TABLE t1 (col1 date) engine=myisam;
--error 1292 --error 1292
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1'); INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
@ -72,7 +72,7 @@ INSERT ignore INTO t1 VALUES('2003-02-31');
select * from t1; select * from t1;
drop table t1; drop table t1;
set @@sql_mode="strict_trans_tables"; set @@sql_mode='strict_trans_tables';
CREATE TABLE t1 (col1 date) engine=innodb; CREATE TABLE t1 (col1 date) engine=innodb;
--error 1292 --error 1292
INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1'); INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1');
@ -161,7 +161,7 @@ set @@sql_mode='ansi,traditional';
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Test TINYINT # Test INSERT with TINYINT
CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED); CREATE TABLE t1(col1 TINYINT, col2 TINYINT UNSIGNED);
INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0); INSERT INTO t1 VALUES(-128,0),(0,0),(127,255),('-128','0'),('0','0'),('127','255'),(-128.0,0.0),(0.0,0.0),(127.0,255.0);
@ -211,7 +211,7 @@ UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Test SMALLINT # Test INSERT with SMALLINT
CREATE TABLE t1(col1 SMALLINT, col2 SMALLINT UNSIGNED); CREATE TABLE t1(col1 SMALLINT, col2 SMALLINT UNSIGNED);
INSERT INTO t1 VALUES(-32768,0),(0,0),(32767,65535),('-32768','0'),('32767','65535'),(-32768.0,0.0),(32767.0,65535.0); INSERT INTO t1 VALUES(-32768,0),(0,0),(32767,65535),('-32768','0'),('32767','65535'),(-32768.0,0.0),(32767.0,65535.0);
@ -264,7 +264,7 @@ UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Test MEDIUMINT # Test INSERT with MEDIUMINT
CREATE TABLE t1 (col1 MEDIUMINT, col2 MEDIUMINT UNSIGNED); CREATE TABLE t1 (col1 MEDIUMINT, col2 MEDIUMINT UNSIGNED);
INSERT INTO t1 VALUES(-8388608,0),(0,0),(8388607,16777215),('-8388608','0'),('8388607','16777215'),(-8388608.0,0.0),(8388607.0,16777215.0); INSERT INTO t1 VALUES(-8388608,0),(0,0),(8388607,16777215),('-8388608','0'),('8388607','16777215'),(-8388608.0,0.0),(8388607.0,16777215.0);
@ -317,7 +317,7 @@ UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Test INT # Test INSERT with INT
CREATE TABLE t1 (col1 INT, col2 INT UNSIGNED); CREATE TABLE t1 (col1 INT, col2 INT UNSIGNED);
INSERT INTO t1 VALUES(-2147483648,0),(0,0),(2147483647,4294967295),('-2147483648','0'),('2147483647','4294967295'),(-2147483648.0,0.0),(2147483647.0,4294967295.0); INSERT INTO t1 VALUES(-2147483648,0),(0,0),(2147483647,4294967295),('-2147483648','0'),('2147483647','4294967295'),(-2147483648.0,0.0),(2147483647.0,4294967295.0);
@ -369,7 +369,7 @@ UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Test BIGINT # Test INSERT with BIGINT
# Note that this doesn't behave 100 % to standard as we rotate # Note that this doesn't behave 100 % to standard as we rotate
# integers when it's too big/small (just like C) # integers when it's too big/small (just like C)
@ -427,6 +427,8 @@ UPDATE IGNORE t1 SET col2=1/NULL where col1=0;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Test INSERT with NUMERIC
CREATE TABLE t1 (col1 NUMERIC(4,2)); CREATE TABLE t1 (col1 NUMERIC(4,2));
INSERT INTO t1 VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01); INSERT INTO t1 VALUES (10.55),(10.5555),(0),(-10.55),(-10.5555),(11),(1e+01);
-- Note that the +/-10.5555 is inserted as +/-10.55, not +/-10.56 ! -- Note that the +/-10.5555 is inserted as +/-10.55, not +/-10.56 !
@ -474,3 +476,149 @@ INSERT IGNORE INTO t1 VALUES(1000.0),(-1000.0);
UPDATE IGNORE t1 SET col1=1/NULL where col1=0; UPDATE IGNORE t1 SET col1=1/NULL where col1=0;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Test INSERT with FLOAT
CREATE TABLE t1 (col1 FLOAT, col2 FLOAT UNSIGNED);
INSERT INTO t1 VALUES (-1.1E-38,0),(+3.4E+38,+3.4E+38);
INSERT INTO t1 VALUES ('-1.1E-38',0),('+3.4E+38','+3.4E+38');
# We don't give warnings for underflow
INSERT INTO t1 (col1) VALUES (3E-46);
--error 1264
INSERT INTO t1 (col1) VALUES (+3.4E+39);
--error 1264
INSERT INTO t1 (col2) VALUES (-1.1E-3);
--error 1264
INSERT INTO t1 (col1) VALUES ('+3.4E+39');
--error 1264
INSERT INTO t1 (col2) VALUES ('-1.1E-3');
--error 1264
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
--error 1365
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365
SELECT MOD(col1,0) FROM t1;
--error 1265
INSERT INTO t1 (col1) VALUES ('');
--error 1265
INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265
INSERT INTO t1 (col1) VALUES ('1a');
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
INSERT IGNORE INTO t1 (col1) VALUES (1/0);
INSERT IGNORE INTO t1 VALUES (+3.4E+39,-3.4E+39);
INSERT IGNORE INTO t1 VALUES ('+3.4E+39','-3.4E+39');
SELECT * FROM t1;
DROP TABLE t1;
# Test INSERT with DOUBLE
CREATE TABLE t1 (col1 DOUBLE PRECISION, col2 DOUBLE PRECISION UNSIGNED);
INSERT INTO t1 VALUES (-2.2E-308,0),(+1.7E+308,+1.7E+308);
INSERT INTO t1 VALUES ('-2.2E-308',0),('+1.7E+308','+1.7E+308');
# We don't give warnings for underflow
INSERT INTO t1 (col1) VALUES (-2.2E-330);
--error 1367
INSERT INTO t1 (col1) VALUES (+1.7E+309);
--error 1264
INSERT INTO t1 (col2) VALUES (-1.1E-3);
--error 1264
INSERT INTO t1 (col1) VALUES ('+1.8E+309');
--error 1264
INSERT INTO t1 (col2) VALUES ('-1.2E-3');
--error 1264
UPDATE t1 SET col1 =col1 * 5000 WHERE col1 > 0;
--error 1365
UPDATE t1 SET col2 =col2 / 0 WHERE col2 > 0;
--error 1365
SELECT MOD(col1,0) FROM t1;
--error 1265
INSERT INTO t1 (col1) VALUES ('');
--error 1265
INSERT INTO t1 (col1) VALUES ('a59b');
--error 1265
INSERT INTO t1 (col1) VALUES ('1a');
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
INSERT IGNORE INTO t1 (col1) values (1/0);
--error 1367
INSERT IGNORE INTO t1 VALUES (+1.9E+309,-1.9E+309);
INSERT IGNORE INTO t1 VALUES ('+2.0E+309','-2.0E+309');
SELECT * FROM t1;
DROP TABLE t1;
# Testing INSERT with CHAR/VARCHAR
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(5));
INSERT INTO t1 VALUES ('hello', 'hello'),('he', 'he'),('hello ', 'hello ');
--error 1265
INSERT INTO t1 (col1) VALUES ('hellobob');
--error 1265
INSERT INTO t1 (col2) VALUES ('hellobob');
--error 1265
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
--error 1265
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob');
UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he';
SELECT * FROM t1;
DROP TABLE t1;
# Testing INSERT with ENUM
CREATE TABLE t1 (col1 enum('red','blue','green'));
INSERT INTO t1 VALUES ('red'),('blue'),('green');
--error 1265
INSERT INTO t1 (col1) VALUES ('yellow');
--error 1265
INSERT INTO t1 (col1) VALUES ('redd');
--error 1265
INSERT INTO t1 VALUES ('');
--error 1265
UPDATE t1 SET col1 ='yellow' WHERE col1 ='green';
INSERT IGNORE INTO t1 VALUES ('yellow');
UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';
SELECT * FROM t1;
DROP TABLE t1;
# Testing of insert of NULL in not NULL column
CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);
INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');
INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');
--error 1048
INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
--error 1048
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
--error 1048
INSERT INTO t1 VALUES (103,'',NULL);
--error 1263
UPDATE t1 SET col1=NULL WHERE col1 =100;
--error 1263
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
--error 1263
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
SELECT * FROM t1;
DROP TABLE t1;
# Testing of default values
CREATE TABLE t1 (col1 INT NOT NULL default 99, col2 CHAR(6) NOT NULL);
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES (1, 'hello');
INSERT INTO t1 (col2) VALUES ('hello2');
--error 1048
INSERT INTO t1 (col2) VALUES (NULL);
--error 1364
INSERT INTO t1 (col1) VALUES (2);
--error 1364
INSERT INTO t1 VALUES(default(col1),default(col2));
--error 1364
INSERT INTO t1 (col1) SELECT 1;
--error 1263
INSERT INTO t1 SELECT 1,NULL;
INSERT IGNORE INTO t1 values (NULL,NULL);
INSERT IGNORE INTO t1 (col1) values (3);
INSERT IGNORE INTO t1 () values ();
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -15,7 +15,7 @@ ALTER TABLE host type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE func type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE func type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE columns_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE columns_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE tables_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin; ALTER TABLE tables_priv type=MyISAM, CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
ALTER TABLE user change Password Password char(41) binary not null; ALTER TABLE user change Password Password char(41) binary not null default '';
ALTER TABLE user add File_priv enum('N','Y') NOT NULL; ALTER TABLE user add File_priv enum('N','Y') NOT NULL;
CREATE TABLE IF NOT EXISTS func ( CREATE TABLE IF NOT EXISTS func (
name char(64) binary DEFAULT '' NOT NULL, name char(64) binary DEFAULT '' NOT NULL,
@ -115,9 +115,9 @@ UPDATE user SET Show_db_priv= Select_priv, Super_priv=Process_priv, Execute_priv
-- for some users. -- for some users.
ALTER TABLE user ALTER TABLE user
ADD max_questions int(11) NOT NULL AFTER x509_subject, ADD max_questions int(11) NOT NULL DEFAULT 0 AFTER x509_subject,
ADD max_updates int(11) unsigned NOT NULL AFTER max_questions, ADD max_updates int(11) unsigned NOT NULL DEFAULT 0 AFTER max_questions,
ADD max_connections int(11) unsigned NOT NULL AFTER max_updates; ADD max_connections int(11) unsigned NOT NULL DEFAULT 0 AFTER max_updates;
-- --

View File

@ -2290,10 +2290,13 @@ int Field_float::store(const char *from,uint len,CHARSET_INFO *cs)
int error; int error;
char *end; char *end;
double nr= my_strntod(cs,(char*) from,len,&end,&error); double nr= my_strntod(cs,(char*) from,len,&end,&error);
if (error || ((uint) (end-from) != len && table->in_use->count_cuted_fields)) if (error || (!len || (uint) (end-from) != len &&
table->in_use->count_cuted_fields))
{ {
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
(error ? ER_WARN_DATA_OUT_OF_RANGE : ER_WARN_DATA_TRUNCATED),
1);
error= 1; error= 1;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
} }
Field_float::store(nr); Field_float::store(nr);
return error; return error;
@ -2592,10 +2595,13 @@ int Field_double::store(const char *from,uint len,CHARSET_INFO *cs)
int error; int error;
char *end; char *end;
double nr= my_strntod(cs,(char*) from, len, &end, &error); double nr= my_strntod(cs,(char*) from, len, &end, &error);
if (error || ((uint) (end-from) != len && table->in_use->count_cuted_fields)) if (error || (!len || (uint) (end-from) != len &&
table->in_use->count_cuted_fields))
{ {
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN,
(error ? ER_WARN_DATA_OUT_OF_RANGE : ER_WARN_DATA_TRUNCATED),
1);
error= 1; error= 1;
set_warning(MYSQL_ERROR::WARN_LEVEL_WARN, ER_WARN_DATA_TRUNCATED, 1);
} }
Field_double::store(nr); Field_double::store(nr);
return error; return error;

View File

@ -1272,6 +1272,7 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define FIELDFLAG_LEFT_FULLSCREEN 8192 #define FIELDFLAG_LEFT_FULLSCREEN 8192
#define FIELDFLAG_RIGHT_FULLSCREEN 16384 #define FIELDFLAG_RIGHT_FULLSCREEN 16384
#define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output #define FIELDFLAG_FORMAT_NUMBER 16384 // predit: ###,,## in output
#define FIELDFLAG_NO_DEFAULT 16384 /* sql */
#define FIELDFLAG_SUM ((uint) 32768)// predit: +#fieldflag #define FIELDFLAG_SUM ((uint) 32768)// predit: +#fieldflag
#define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql #define FIELDFLAG_MAYBE_NULL ((uint) 32768)// sql
#define FIELDFLAG_PACK_SHIFT 3 #define FIELDFLAG_PACK_SHIFT 3
@ -1280,8 +1281,6 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define FIELDFLAG_NUM_SCREEN_TYPE 0x7F01 #define FIELDFLAG_NUM_SCREEN_TYPE 0x7F01
#define FIELDFLAG_ALFA_SCREEN_TYPE 0x7800 #define FIELDFLAG_ALFA_SCREEN_TYPE 0x7800
#define FIELD_SORT_REVERSE 16384
#define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */ #define MTYP_TYPENR(type) (type & 127) /* Remove bits from type */
#define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL) #define f_is_dec(x) ((x) & FIELDFLAG_DECIMAL)
@ -1299,3 +1298,4 @@ int set_field_to_null_with_conversions(Field *field, bool no_conversions);
#define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256)) #define f_is_equ(x) ((x) & (1+2+FIELDFLAG_PACK+31*256))
#define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT) #define f_settype(x) (((int) x) << FIELDFLAG_PACK_SHIFT)
#define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL) #define f_maybe_null(x) (x & FIELDFLAG_MAYBE_NULL)
#define f_no_default(x) (x & FIELDFLAG_NO_DEFAULT)

View File

@ -1862,6 +1862,34 @@ Item_num *Item_uint::neg()
return new Item_real(name, - ((double) value), 0, max_length); return new Item_real(name, - ((double) value), 0, max_length);
} }
/*
This function is only called during parsing. We will signal an error if
value is not a true double value (overflow)
*/
Item_real::Item_real(const char *str_arg, uint length)
{
int error;
char *end;
value= my_strntod(&my_charset_bin, (char*) str_arg, length, &end, &error);
if (error)
{
/*
Note that we depend on that str_arg is null terminated, which is true
when we are in the parser
*/
DBUG_ASSERT(str_arg[length] == 0);
my_printf_error(ER_ILLEGAL_VALUE_FOR_TYPE, ER(ER_ILLEGAL_VALUE_FOR_TYPE),
MYF(0), "double", (char*) str_arg);
}
presentation= name=(char*) str_arg;
decimals=(uint8) nr_of_decimals(str_arg);
max_length=length;
fixed= 1;
}
int Item_real::save_in_field(Field *field, bool no_conversions) int Item_real::save_in_field(Field *field, bool no_conversions)
{ {
double nr=val(); double nr=val();
@ -2381,7 +2409,10 @@ bool Item_default_value::fix_fields(THD *thd,
struct st_table_list *table_list, struct st_table_list *table_list,
Item **items) Item **items)
{ {
Item_field *field_arg;
Field *def_field;
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (!arg) if (!arg)
{ {
fixed= 1; fixed= 1;
@ -2399,9 +2430,14 @@ bool Item_default_value::fix_fields(THD *thd,
} }
arg= ref->ref[0]; arg= ref->ref[0];
} }
Item_field *field_arg= (Item_field *)arg; field_arg= (Item_field *)arg;
Field *def_field= (Field*) sql_alloc(field_arg->field->size_of()); if (field_arg->field->flags & NO_DEFAULT_VALUE_FLAG)
if (!def_field) {
my_printf_error(ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD),
MYF(0), field_arg->field->field_name);
return 1;
}
if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of())))
return 1; return 1;
memcpy(def_field, field_arg->field, field_arg->field->size_of()); memcpy(def_field, field_arg->field, field_arg->field->size_of());
def_field->move_field(def_field->table->default_values - def_field->move_field(def_field->table->default_values -

View File

@ -707,13 +707,7 @@ class Item_real :public Item_num
public: public:
double value; double value;
// Item_real() :value(0) {} // Item_real() :value(0) {}
Item_real(const char *str_arg, uint length) :value(my_atof(str_arg)) Item_real(const char *str_arg, uint length);
{
presentation= name=(char*) str_arg;
decimals=(uint8) nr_of_decimals(str_arg);
max_length=length;
fixed= 1;
}
Item_real(const char *str,double val_arg,uint decimal_par,uint length) Item_real(const char *str,double val_arg,uint decimal_par,uint length)
:value(val_arg) :value(val_arg)
{ {

View File

@ -2090,7 +2090,7 @@ extern "C" int my_message_sql(uint error, const char *str,
{ {
THD *thd; THD *thd;
DBUG_ENTER("my_message_sql"); DBUG_ENTER("my_message_sql");
DBUG_PRINT("error", ("Message: '%s'", str)); DBUG_PRINT("error", ("error: %u message: '%s'", error, str));
if ((thd= current_thd)) if ((thd= current_thd))
{ {
if (thd->spcont && if (thd->spcont &&

View File

@ -291,7 +291,7 @@ character-set=latin2
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -395,3 +395,4 @@ character-set=latin2
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -282,7 +282,7 @@ character-set=latin1
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -386,3 +386,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -291,7 +291,7 @@ character-set=latin1
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -395,3 +395,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -279,7 +279,7 @@ character-set=latin1
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -383,3 +383,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -284,7 +284,7 @@ character-set=latin7
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -388,3 +388,4 @@ character-set=latin7
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -279,7 +279,7 @@ character-set=latin1
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -383,3 +383,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -396,3 +396,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -279,7 +279,7 @@ character-set=greek
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -383,3 +383,4 @@ character-set=greek
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -284,7 +284,7 @@ character-set=latin2
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -388,3 +388,4 @@ character-set=latin2
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -279,7 +279,7 @@ character-set=latin1
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -383,3 +383,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -283,7 +283,7 @@ character-set=ujis
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -387,3 +387,4 @@ character-set=ujis
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -279,7 +279,7 @@ character-set=euckr
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -383,3 +383,4 @@ character-set=euckr
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -281,7 +281,7 @@ character-set=latin1
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -385,3 +385,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -281,7 +281,7 @@ character-set=latin1
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -385,3 +385,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -284,7 +284,7 @@ character-set=latin2
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -388,3 +388,4 @@ character-set=latin2
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -385,3 +385,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -284,7 +284,7 @@ character-set=latin2
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -388,3 +388,4 @@ character-set=latin2
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -284,7 +284,7 @@ character-set=koi8r
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -388,3 +388,4 @@ character-set=koi8r
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -272,7 +272,7 @@ character-set=cp1250
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -376,3 +376,4 @@ character-set=cp1250
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -287,7 +287,7 @@ character-set=latin2
"%d line(s) were cut by GROUP_CONCAT()", "%d line(s) were cut by GROUP_CONCAT()",
"Row %ld doesn't contain data for all columns", "Row %ld doesn't contain data for all columns",
"Row %ld was truncated; it contained more data than there were input columns", "Row %ld was truncated; it contained more data than there were input columns",
"Data truncated; NULL supplied to NOT NULL column '%s' at row %ld", "Column set to default value; NULL supplied to NOT NULL column '%s' at row %ld",
"Out of range value adjusted for column '%s' at row %ld", "Out of range value adjusted for column '%s' at row %ld",
"Data truncated for column '%s' at row %ld", "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
@ -391,3 +391,4 @@ character-set=latin2
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -387,3 +387,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -383,3 +383,4 @@ character-set=latin1
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -389,3 +389,4 @@ character-set=koi8u
"Field '%-.64s' doesn't have a default value", "Field '%-.64s' doesn't have a default value",
"Division by 0", "Division by 0",
"Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld", "Incorrect %-.32s value: '%-.128s' for column '%.64s' at row %ld",
"Illegal %s '%-.64s' value found during parsing",

View File

@ -246,9 +246,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
/* /*
Count warnings for all inserts. Count warnings for all inserts.
For single line insert, generate an error if try to set a NOT NULL field For single line insert, generate an error if try to set a NOT NULL field
to NULL to NULL.
*/ */
thd->count_cuted_fields= ((values_list.elements == 1) ? thd->count_cuted_fields= ((values_list.elements == 1 &&
duplic != DUP_IGNORE) ?
CHECK_FIELD_ERROR_FOR_NULL : CHECK_FIELD_ERROR_FOR_NULL :
CHECK_FIELD_WARN); CHECK_FIELD_WARN);
thd->cuted_fields = 0L; thd->cuted_fields = 0L;
@ -276,7 +277,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
(MODE_STRICT_TRANS_TABLES | (MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES))); MODE_STRICT_ALL_TABLES)));
if (check_that_all_fields_are_given_values(thd, table)) if (fields.elements && check_that_all_fields_are_given_values(thd, table))
{ {
/* thd->net.report_error is now set, which will abort the next loop */ /* thd->net.report_error is now set, which will abort the next loop */
error= 1; error= 1;
@ -784,13 +785,11 @@ err:
/****************************************************************************** /******************************************************************************
Check that all fields with arn't null_fields are used Check that all fields with arn't null_fields are used
If DONT_USE_DEFAULT_FIELDS isn't defined use default value for not set
fields.
******************************************************************************/ ******************************************************************************/
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry) int check_that_all_fields_are_given_values(THD *thd, TABLE *entry)
{ {
if (!thd->abort_on_warning) if (!thd->abort_on_warning) // No check if not strict mode
return 0; return 0;
for (Field **field=entry->field ; *field ; field++) for (Field **field=entry->field ; *field ; field++)
@ -1666,7 +1665,8 @@ select_insert::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
(thd->variables.sql_mode & (thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | (MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES))); MODE_STRICT_ALL_TABLES)));
DBUG_RETURN(check_that_all_fields_are_given_values(thd, table)); DBUG_RETURN(fields->elements &&
check_that_all_fields_are_given_values(thd, table));
} }

View File

@ -4710,9 +4710,14 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
new_field->comment.str= (char*) comment->str; new_field->comment.str= (char*) comment->str;
new_field->comment.length=comment->length; new_field->comment.length=comment->length;
} }
/* Set flag if this field doesn't have a default value */ /*
Set flag if this field doesn't have a default value
Enum values has always the first value as a default (set in
make_empty_rec().
*/
if (!default_value && !(type_modifier & AUTO_INCREMENT_FLAG) && if (!default_value && !(type_modifier & AUTO_INCREMENT_FLAG) &&
(type_modifier & NOT_NULL_FLAG) && type != FIELD_TYPE_TIMESTAMP) (type_modifier & NOT_NULL_FLAG) && type != FIELD_TYPE_TIMESTAMP &&
type != FIELD_TYPE_ENUM)
new_field->flags|= NO_DEFAULT_VALUE_FLAG; new_field->flags|= NO_DEFAULT_VALUE_FLAG;
if (length && !(new_field->length= (uint) atoi(length))) if (length && !(new_field->length= (uint) atoi(length)))

View File

@ -786,7 +786,8 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
protocol->store("CURRENT_TIMESTAMP", system_charset_info); protocol->store("CURRENT_TIMESTAMP", system_charset_info);
} }
else if (field->unireg_check != Field::NEXT_NUMBER && else if (field->unireg_check != Field::NEXT_NUMBER &&
!field->is_null()) !field->is_null() &&
!(field->flags & NO_DEFAULT_VALUE_FLAG))
{ // Not null by default { // Not null by default
/* /*
Note: we have to convert the default value into Note: we have to convert the default value into
@ -1396,6 +1397,7 @@ store_create_info(THD *thd, TABLE *table, String *packet)
field->unireg_check != Field::TIMESTAMP_UN_FIELD; field->unireg_check != Field::TIMESTAMP_UN_FIELD;
has_default= (field->type() != FIELD_TYPE_BLOB && has_default= (field->type() != FIELD_TYPE_BLOB &&
!(field->flags & NO_DEFAULT_VALUE_FLAG) &&
field->unireg_check != Field::NEXT_NUMBER && field->unireg_check != Field::NEXT_NUMBER &&
!((foreign_db_mode || limited_mysql_mode) && !((foreign_db_mode || limited_mysql_mode) &&
has_now_default)); has_now_default));

View File

@ -610,6 +610,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
} }
if (!(sql_field->flags & NOT_NULL_FLAG)) if (!(sql_field->flags & NOT_NULL_FLAG))
sql_field->pack_flag|= FIELDFLAG_MAYBE_NULL; sql_field->pack_flag|= FIELDFLAG_MAYBE_NULL;
if (sql_field->flags & NO_DEFAULT_VALUE_FLAG)
sql_field->pack_flag|= FIELDFLAG_NO_DEFAULT;
sql_field->offset= pos; sql_field->offset= pos;
if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER) if (MTYP_TYPENR(sql_field->unireg_check) == Field::NEXT_NUMBER)
auto_increment++; auto_increment++;

View File

@ -351,9 +351,10 @@ int mysql_update(THD *thd,
transactional_table= table->file->has_transactions(); transactional_table= table->file->has_transactions();
thd->no_trans_update= 0; thd->no_trans_update= 0;
thd->abort_on_warning= test(thd->variables.sql_mode & thd->abort_on_warning= test(handle_duplicates != DUP_IGNORE &&
(thd->variables.sql_mode &
(MODE_STRICT_TRANS_TABLES | (MODE_STRICT_TRANS_TABLES |
MODE_STRICT_ALL_TABLES)); MODE_STRICT_ALL_TABLES)));
while (!(error=info.read_record(&info)) && !thd->killed) while (!(error=info.read_record(&info)) && !thd->killed)
{ {

View File

@ -6448,8 +6448,24 @@ NUM_literal:
NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); } NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); }
| LONG_NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); } | LONG_NUM { int error; $$ = new Item_int($1.str, (longlong) my_strtoll10($1.str, NULL, &error), $1.length); }
| ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); } | ULONGLONG_NUM { $$ = new Item_uint($1.str, $1.length); }
| REAL_NUM { $$ = new Item_real($1.str, $1.length); } | REAL_NUM
| FLOAT_NUM { $$ = new Item_float($1.str, $1.length); } {
$$= new Item_real($1.str, $1.length);
if (YYTHD->net.report_error)
{
send_error(YYTHD, 0, NullS);
YYABORT;
}
}
| FLOAT_NUM
{
$$ = new Item_float($1.str, $1.length);
if (YYTHD->net.report_error)
{
send_error(YYTHD, 0, NullS);
YYABORT;
}
}
; ;
/********************************************************************** /**********************************************************************

View File

@ -461,7 +461,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
field_length= (uint) strpos[3]; field_length= (uint) strpos[3];
recpos= uint2korr(strpos+4), recpos= uint2korr(strpos+4),
pack_flag= uint2korr(strpos+6); pack_flag= uint2korr(strpos+6);
pack_flag&= ~NO_DEFAULT_VALUE_FLAG; // Safety for old files pack_flag&= ~FIELDFLAG_NO_DEFAULT; // Safety for old files
unireg_type= (uint) strpos[8]; unireg_type= (uint) strpos[8];
interval_nr= (uint) strpos[10]; interval_nr= (uint) strpos[10];
@ -498,6 +498,8 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
null_bit=1; null_bit=1;
} }
} }
if (f_no_default(pack_flag))
reg_field->flags|= NO_DEFAULT_VALUE_FLAG;
if (reg_field->unireg_check == Field::NEXT_NUMBER) if (reg_field->unireg_check == Field::NEXT_NUMBER)
outparam->found_next_number_field= reg_field; outparam->found_next_number_field= reg_field;
if (outparam->timestamp_field == reg_field) if (outparam->timestamp_field == reg_field)