diff options
author | unknown <elliot@mysql.com> | 2006-04-28 12:15:29 -0400 |
---|---|---|
committer | unknown <elliot@mysql.com> | 2006-04-28 12:15:29 -0400 |
commit | dd68976a249cf73d6bf67faa37108438b26e800c (patch) | |
tree | a1a6f77b937a2fd005b4ab4083ce3d0757c2f12e /mysql-test/t/null.test | |
parent | e92e1dace7529271a401273bdf265adf863b6c77 (diff) | |
download | mariadb-git-dd68976a249cf73d6bf67faa37108438b26e800c.tar.gz |
BUG#19145: mysqld crashes if you set the default value of an enum field to NULL
Now test for NULLness the pointers returned from objects created from the
default value. Pushing patch on behalf of cmiller.
mysql-test/r/null.result:
Add test case
mysql-test/t/null.test:
Add test case
sql/sql_table.cc:
No longer blindly dereference pointer of the string representation of the
values, where "NULL" is NUL. Raise INVALID DEFAULT error messages where
appropriate.
Note that the -O1 optimization flag made debugging this extremely tricky, with
misleading results, and that removing it from the Makefile during debugging can
be invaluable.
Diffstat (limited to 'mysql-test/t/null.test')
-rw-r--r-- | mysql-test/t/null.test | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/mysql-test/t/null.test b/mysql-test/t/null.test index 731f0a4cb34..b405b8fb852 100644 --- a/mysql-test/t/null.test +++ b/mysql-test/t/null.test @@ -187,4 +187,45 @@ select # Restore charset to the default value. set names latin1; +# +# Bug#19145: mysqld crashes if you set the default value of an enum field to NULL +# +create table bug19145a (e enum('a','b','c') default 'b' , s set('x', 'y', 'z') default 'y' ) engine=MyISAM; +create table bug19145b (e enum('a','b','c') default null, s set('x', 'y', 'z') default null) engine=MyISAM; + +create table bug19145c (e enum('a','b','c') not null default 'b' , s set('x', 'y', 'z') not null default 'y' ) engine=MyISAM; + +# Invalid default value for 's' +--error 1067 +create table bug19145setnotnulldefaultnull (e enum('a','b','c') default null, s set('x', 'y', 'z') not null default null) engine=MyISAM; + +# Invalid default value for 'e' +--error 1067 +create table bug19145enumnotnulldefaultnull (e enum('a','b','c') not null default null, s set('x', 'y', 'z') default null) engine=MyISAM; + +alter table bug19145a alter column e set default null; +alter table bug19145a alter column s set default null; +alter table bug19145a add column (i int); + +alter table bug19145b alter column e set default null; +alter table bug19145b alter column s set default null; +alter table bug19145b add column (i int); + +# Invalid default value for 'e' +--error 1067 +alter table bug19145c alter column e set default null; + +# Invalid default value for 's' +--error 1067 +alter table bug19145c alter column s set default null; +alter table bug19145c add column (i int); + +show create table bug19145a; +show create table bug19145b; +show create table bug19145c; + +drop table bug19145a; +drop table bug19145b; +drop table bug19145c; + # End of 4.1 tests |