Commit d68721d0 authored by unknown's avatar unknown

Merge bk-internal.mysql.com:/home/bk/mysql-maria

into  mysql.com:/home/my/mysql-maria


mysql-test/r/maria.result:
  Auto merged
mysql-test/t/maria.test:
  Auto merged
sql/sql_table.cc:
  Auto merged
storage/maria/ma_create.c:
  Auto merged
storage/maria/ma_pagecrc.c:
  Auto merged
parents d455550d 01502c42
...@@ -3072,3 +3072,4 @@ libmysqld/sql_profile.cc ...@@ -3072,3 +3072,4 @@ libmysqld/sql_profile.cc
*.exp *.exp
comments comments
maria-win.patch maria-win.patch
storage/maria/maria_dump_log
...@@ -2071,6 +2071,37 @@ Maria_pagecache_read_requests # ...@@ -2071,6 +2071,37 @@ Maria_pagecache_read_requests #
Maria_pagecache_reads # Maria_pagecache_reads #
Maria_pagecache_write_requests # Maria_pagecache_write_requests #
Maria_pagecache_writes # 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; set global maria_page_checksum=1;
create table t1 (a int); create table t1 (a int);
show create table t1; show create table t1;
......
...@@ -1315,6 +1315,23 @@ show variables like 'maria%'; ...@@ -1315,6 +1315,23 @@ show variables like 'maria%';
--replace_column 2 # --replace_column 2 #
show status 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 # Show that page_checksum is remembered
# #
......
...@@ -2899,7 +2899,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info, ...@@ -2899,7 +2899,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
else if (!(file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS)) else if (!(file->ha_table_flags() & HA_NO_PREFIX_CHAR_KEYS))
length=column->length; length=column->length;
} }
else if (length == 0) else if (length == 0 && (sql_field->flags & NOT_NULL_FLAG))
{ {
my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name); my_error(ER_WRONG_KEY_COLUMN, MYF(0), column->field_name);
DBUG_RETURN(TRUE); DBUG_RETURN(TRUE);
......
...@@ -85,7 +85,7 @@ int maria_create(const char *name, enum data_file_type datafile_type, ...@@ -85,7 +85,7 @@ int maria_create(const char *name, enum data_file_type datafile_type,
ci=&tmp_create_info; ci=&tmp_create_info;
} }
if (keys + uniques > MARIA_MAX_KEY || columns == 0) if (keys + uniques > MARIA_MAX_KEY)
{ {
DBUG_RETURN(my_errno=HA_WRONG_CREATE_OPTION); DBUG_RETURN(my_errno=HA_WRONG_CREATE_OPTION);
} }
......
...@@ -305,6 +305,10 @@ my_bool maria_page_filler_set_none(uchar *page __attribute__((unused)), ...@@ -305,6 +305,10 @@ my_bool maria_page_filler_set_none(uchar *page __attribute__((unused)),
__attribute__((unused)), __attribute__((unused)),
uchar *data_ptr __attribute__((unused))) uchar *data_ptr __attribute__((unused)))
{ {
#ifdef HAVE_purify
int4store_aligned(page + ((MARIA_SHARE *)data_ptr)->block_size - CRC_SIZE,
0);
#endif
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment