mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Output 'MEMORY' as table type for tables using the memory (nee heap) storage
engine, except when running with sql_mode & MYSQL323. (Bug #6659)
This commit is contained in:
parent
f01f721672
commit
3998da80e9
7 changed files with 49 additions and 45 deletions
|
@ -204,7 +204,7 @@ show create table t1;
|
|||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
SET SESSION storage_engine="gemini";
|
||||
ERROR 42000: Unknown table engine 'gemini'
|
||||
|
@ -216,7 +216,7 @@ show create table t1;
|
|||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
SET SESSION storage_engine=default;
|
||||
drop table t1;
|
||||
create table t1 ( k1 varchar(2), k2 int, primary key(k1,k2));
|
||||
|
@ -361,7 +361,7 @@ show create table t1;
|
|||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
SET SESSION storage_engine="gemini";
|
||||
ERROR 42000: Unknown table engine 'gemini'
|
||||
|
@ -373,7 +373,7 @@ show create table t1;
|
|||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` int(11) NOT NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
SET SESSION storage_engine=default;
|
||||
drop table t1;
|
||||
create table t1(a int,b int,c int unsigned,d date,e char,f datetime,g time,h blob);
|
||||
|
|
|
@ -413,7 +413,7 @@ Table Create Table
|
|||
t1 CREATE TABLE `t1` (
|
||||
`c` char(10) character set utf8 default NULL,
|
||||
UNIQUE KEY `a` (`c`(1))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
insert into t1 values ('aa');
|
||||
ERROR 23000: Duplicate entry 'aa' for key 1
|
||||
|
@ -449,7 +449,7 @@ Table Create Table
|
|||
t1 CREATE TABLE `t1` (
|
||||
`c` char(10) character set utf8 default NULL,
|
||||
UNIQUE KEY `a` USING BTREE (`c`(1))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
insert into t1 values ('aa');
|
||||
ERROR 23000: Duplicate entry 'aa' for key 1
|
||||
|
@ -571,7 +571,7 @@ Table Create Table
|
|||
t1 CREATE TABLE `t1` (
|
||||
`c` char(10) character set utf8 collate utf8_bin default NULL,
|
||||
UNIQUE KEY `a` (`c`(1))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
insert into t1 values ('aa');
|
||||
ERROR 23000: Duplicate entry 'aa' for key 1
|
||||
|
@ -607,7 +607,7 @@ Table Create Table
|
|||
t1 CREATE TABLE `t1` (
|
||||
`c` char(10) character set utf8 collate utf8_bin default NULL,
|
||||
UNIQUE KEY `a` USING BTREE (`c`(1))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
insert into t1 values ('a'),('b'),('c'),('d'),('e'),('f');
|
||||
insert into t1 values ('aa');
|
||||
ERROR 23000: Duplicate entry 'aa' for key 1
|
||||
|
|
|
@ -266,7 +266,7 @@ t1 CREATE TABLE `t1` (
|
|||
`v` varchar(10) default NULL,
|
||||
`c` char(10) default NULL,
|
||||
`t` varchar(50) default NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
create table t2 like t1;
|
||||
show create table t2;
|
||||
Table Create Table
|
||||
|
@ -274,7 +274,7 @@ t2 CREATE TABLE `t2` (
|
|||
`v` varchar(10) default NULL,
|
||||
`c` char(10) default NULL,
|
||||
`t` varchar(50) default NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
create table t3 select * from t1;
|
||||
show create table t3;
|
||||
Table Create Table
|
||||
|
@ -282,7 +282,7 @@ t3 CREATE TABLE `t3` (
|
|||
`v` varchar(10) default NULL,
|
||||
`c` char(10) default NULL,
|
||||
`t` varchar(50) default NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
alter table t1 modify c varchar(10);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
|
@ -290,7 +290,7 @@ t1 CREATE TABLE `t1` (
|
|||
`v` varchar(10) default NULL,
|
||||
`c` varchar(10) default NULL,
|
||||
`t` varchar(50) default NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
alter table t1 modify v char(10);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
|
@ -298,7 +298,7 @@ t1 CREATE TABLE `t1` (
|
|||
`v` char(10) default NULL,
|
||||
`c` varchar(10) default NULL,
|
||||
`t` varchar(50) default NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
alter table t1 modify t varchar(10);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 't' at row 2
|
||||
|
@ -308,7 +308,7 @@ t1 CREATE TABLE `t1` (
|
|||
`v` char(10) default NULL,
|
||||
`c` varchar(10) default NULL,
|
||||
`t` varchar(10) default NULL
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
select concat('*',v,'*',c,'*',t,'*') from t1;
|
||||
concat('*',v,'*',c,'*',t,'*')
|
||||
*+*+*+ *
|
||||
|
@ -324,7 +324,7 @@ t1 CREATE TABLE `t1` (
|
|||
KEY `v` (`v`),
|
||||
KEY `c` (`c`),
|
||||
KEY `t` (`t`(10))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
270
|
||||
|
@ -559,7 +559,7 @@ t1 CREATE TABLE `t1` (
|
|||
KEY `v` USING BTREE (`v`),
|
||||
KEY `c` USING BTREE (`c`),
|
||||
KEY `t` USING BTREE (`t`(10))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
270
|
||||
|
@ -650,7 +650,7 @@ t1 CREATE TABLE `t1` (
|
|||
KEY `v` (`v`(5)),
|
||||
KEY `c` (`c`(5)),
|
||||
KEY `t` (`t`(5))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1 (v varchar(65530), key(v(10)));
|
||||
show create table t1;
|
||||
|
@ -658,7 +658,7 @@ Table Create Table
|
|||
t1 CREATE TABLE `t1` (
|
||||
`v` varchar(65530) default NULL,
|
||||
KEY `v` (`v`(10))
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1
|
||||
insert into t1 values(repeat('a',65530));
|
||||
select length(v) from t1 where v=repeat('a',65530);
|
||||
length(v)
|
||||
|
|
|
@ -478,7 +478,7 @@ character_sets CREATE TEMPORARY TABLE `character_sets` (
|
|||
`DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
|
||||
`DESCRIPTION` varchar(60) NOT NULL default '',
|
||||
`MAXLEN` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=1818
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8 MAX_ROWS=1818
|
||||
set names latin2;
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets;
|
||||
Table Create Table
|
||||
|
@ -487,7 +487,7 @@ character_sets CREATE TEMPORARY TABLE `character_sets` (
|
|||
`DEFAULT_COLLATE_NAME` varchar(64) NOT NULL default '',
|
||||
`DESCRIPTION` varchar(60) NOT NULL default '',
|
||||
`MAXLEN` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=1818
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=utf8 MAX_ROWS=1818
|
||||
set names latin1;
|
||||
create table t1 select * from information_schema.CHARACTER_SETS
|
||||
where CHARACTER_SET_NAME like "latin1";
|
||||
|
|
|
@ -315,57 +315,57 @@ insert into t2 values (1),(2);
|
|||
insert into t3 values (1,1),(2,2);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 9 Fixed 2 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
insert into t1 values (3),(4);
|
||||
insert into t2 values (3),(4);
|
||||
insert into t3 values (3,3),(4,4);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 9 Fixed 4 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
insert into t1 values (5);
|
||||
insert into t2 values (5);
|
||||
insert into t3 values (5,5);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 9 Fixed 5 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
delete from t1 where a=3;
|
||||
delete from t2 where b=3;
|
||||
delete from t3 where a=3;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 9 Fixed 4 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
delete from t1;
|
||||
delete from t2;
|
||||
delete from t3;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 9 Fixed 0 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
insert into t1 values (5);
|
||||
insert into t2 values (5);
|
||||
insert into t3 values (5,5);
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 9 Fixed 1 # # # # 0 NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
delete from t1 where a=5;
|
||||
delete from t2 where b=5;
|
||||
delete from t3 where a=5;
|
||||
show table status;
|
||||
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
|
||||
t1 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 HEAP 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t1 MEMORY 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t2 MEMORY 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
t3 MEMORY 9 Fixed 0 # # # # # NULL NULL NULL NULL latin1_swedish_ci NULL
|
||||
drop table t1, t2, t3;
|
||||
create database mysqltest;
|
||||
show create database mysqltest;
|
||||
|
|
|
@ -18,7 +18,7 @@ t1 CREATE TABLE `t1` (
|
|||
`email` varchar(60) character set latin2 NOT NULL default '',
|
||||
PRIMARY KEY (`a`),
|
||||
UNIQUE KEY `email` USING BTREE (`email`)
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
set @@sql_mode="ansi_quotes";
|
||||
show variables like 'sql_mode';
|
||||
Variable_name Value
|
||||
|
@ -31,7 +31,7 @@ t1 CREATE TABLE "t1" (
|
|||
"email" varchar(60) character set latin2 NOT NULL default '',
|
||||
PRIMARY KEY ("a"),
|
||||
UNIQUE KEY "email" USING BTREE ("email")
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
set @@sql_mode="no_table_options";
|
||||
show variables like 'sql_mode';
|
||||
Variable_name Value
|
||||
|
@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` (
|
|||
`email` varchar(60) character set latin2 NOT NULL default '',
|
||||
PRIMARY KEY (`a`),
|
||||
UNIQUE KEY `email` (`email`)
|
||||
) ENGINE=HEAP DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
|
||||
set @@sql_mode="no_field_options,mysql323,mysql40";
|
||||
show variables like 'sql_mode';
|
||||
Variable_name Value
|
||||
|
|
|
@ -32,7 +32,11 @@ class ha_heap: public handler
|
|||
public:
|
||||
ha_heap(TABLE *table): handler(table), file(0), records_changed(0) {}
|
||||
~ha_heap() {}
|
||||
const char *table_type() const { return "HEAP"; }
|
||||
const char *table_type() const
|
||||
{
|
||||
return (table->in_use->variables.sql_mode & MODE_MYSQL323) ?
|
||||
"HEAP" : "MEMORY";
|
||||
}
|
||||
const char *index_type(uint inx)
|
||||
{
|
||||
return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ? "BTREE" :
|
||||
|
|
Loading…
Reference in a new issue