summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@mysql.com/nosik.monty.fi>2008-01-21 22:03:24 +0200
committerunknown <monty@mysql.com/nosik.monty.fi>2008-01-21 22:03:24 +0200
commit5cca615cafe821ac37354bafc8057b08ca998f62 (patch)
tree74c13d2d272d860b44041bcc272c741ae03811b2 /mysql-test
parent5b18f8106c582d413cd609e472456e8dee382489 (diff)
downloadmariadb-git-5cca615cafe821ac37354bafc8057b08ca998f62.tar.gz
Allow index on 'CHAR(0) NULL' columns
Fixed error in Maria when using table with only CHAR(0) fields Fixed valgrind warning BitKeeper/etc/ignore: added storage/maria/maria_dump_log mysql-test/r/maria.result: Testing of table with char(0) mysql-test/t/maria.test: Testing of table with char(0) sql/sql_table.cc: Allow index on 'CHAR(0) NULL' columns storage/maria/ma_create.c: Allow creation of table with 0 record data (for example CHAR(0)) storage/maria/ma_pagecrc.c: Fixed valgrind warning
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/bdb_notembedded.result35
-rw-r--r--mysql-test/r/maria.result31
-rw-r--r--mysql-test/t/bdb_notembedded.test38
-rw-r--r--mysql-test/t/maria.test17
4 files changed, 121 insertions, 0 deletions
diff --git a/mysql-test/r/bdb_notembedded.result b/mysql-test/r/bdb_notembedded.result
new file mode 100644
index 00000000000..14cb5fad915
--- /dev/null
+++ b/mysql-test/r/bdb_notembedded.result
@@ -0,0 +1,35 @@
+set autocommit=1;
+reset master;
+create table bug16206 (a int);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
+f n Query 1 n use `test`; create table bug16206 (a int)
+f n Query 1 n use `test`; insert into bug16206 values(1)
+f n Query 1 n use `test`; insert into bug16206 values(2)
+drop table bug16206;
+reset master;
+create table bug16206 (a int) engine= bdb;
+insert into bug16206 values(0);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+insert into bug16206 values(3);
+show binlog events;
+Log_name Pos Event_type Server_id End_log_pos Info
+f n Format_desc 1 n Server ver: VERSION, Binlog ver: 4
+f n Query 1 n use `test`; create table bug16206 (a int) engine= bdb
+f n Query 1 n use `test`; insert into bug16206 values(0)
+f n Query 1 n use `test`; insert into bug16206 values(1)
+f n Query 1 n use `test`; BEGIN
+f n Query 1 n use `test`; insert into bug16206 values(2)
+f n Query 1 n use `test`; COMMIT
+f n Query 1 n use `test`; insert into bug16206 values(3)
+drop table bug16206;
+set autocommit=0;
+End of 5.0 tests
diff --git a/mysql-test/r/maria.result b/mysql-test/r/maria.result
index 8eb226d57ac..a5613678110 100644
--- a/mysql-test/r/maria.result
+++ b/mysql-test/r/maria.result
@@ -2071,6 +2071,37 @@ Maria_pagecache_read_requests #
Maria_pagecache_reads #
Maria_pagecache_write_requests #
Maria_pagecache_writes #
+create table t1 (b char(0));
+insert into t1 values(NULL),("");
+select length(b) from t1;
+length(b)
+NULL
+0
+alter table t1 add column c char(0), add key (c);
+insert into t1 values("",""),("",NULL);
+select length(b),length(c) from t1;
+length(b) length(c)
+NULL NULL
+0 NULL
+0 0
+0 NULL
+select length(b),length(c) from t1 where c is null;
+length(b) length(c)
+NULL NULL
+0 NULL
+0 NULL
+select length(b),length(c) from t1 where c is not null;
+length(b) length(c)
+0 0
+select length(b),length(c) from t1 order by c;
+length(b) length(c)
+NULL NULL
+0 NULL
+0 NULL
+0 0
+alter table t1 add column d char(0) not null, add key (d);
+ERROR 42000: The used storage engine can't index column 'd'
+drop table t1;
set global maria_page_checksum=1;
create table t1 (a int);
show create table t1;
diff --git a/mysql-test/t/bdb_notembedded.test b/mysql-test/t/bdb_notembedded.test
new file mode 100644
index 00000000000..24e64ebbfb2
--- /dev/null
+++ b/mysql-test/t/bdb_notembedded.test
@@ -0,0 +1,38 @@
+-- source include/not_embedded.inc
+-- source include/have_bdb.inc
+
+#
+# Bug #16206: Superfluous COMMIT event in binlog when updating BDB in autocommit mode
+#
+set autocommit=1;
+
+let $VERSION=`select version()`;
+
+reset master;
+create table bug16206 (a int);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+--replace_result $VERSION VERSION
+--replace_column 1 f 2 n 5 n
+show binlog events;
+drop table bug16206;
+
+reset master;
+create table bug16206 (a int) engine= bdb;
+insert into bug16206 values(0);
+insert into bug16206 values(1);
+start transaction;
+insert into bug16206 values(2);
+commit;
+insert into bug16206 values(3);
+--replace_result $VERSION VERSION
+--replace_column 1 f 2 n 5 n
+show binlog events;
+drop table bug16206;
+
+set autocommit=0;
+
+
+--echo End of 5.0 tests
diff --git a/mysql-test/t/maria.test b/mysql-test/t/maria.test
index 120f5178a4c..c262270a619 100644
--- a/mysql-test/t/maria.test
+++ b/mysql-test/t/maria.test
@@ -1316,6 +1316,23 @@ show variables like 'maria%';
show status like 'maria%';
#
+# Test creating table with no field data and index on zero length columns
+#
+
+create table t1 (b char(0));
+insert into t1 values(NULL),("");
+select length(b) from t1;
+alter table t1 add column c char(0), add key (c);
+insert into t1 values("",""),("",NULL);
+select length(b),length(c) from t1;
+select length(b),length(c) from t1 where c is null;
+select length(b),length(c) from t1 where c is not null;
+select length(b),length(c) from t1 order by c;
+--error 1167
+alter table t1 add column d char(0) not null, add key (d);
+drop table t1;
+
+#
# Show that page_checksum is remembered
#
set global maria_page_checksum=1;