mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
After merge fixes
Don't create temporary objects with no table name
This commit is contained in:
@ -297,7 +297,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
for (i=0 ; i < keys ; i++)
|
||||
{
|
||||
disk_pos=mi_keydef_read(disk_pos, &share->keyinfo[i]);
|
||||
disk_pos_assert(disk_pos + share->keyinfo[i].keysegs * MI_KEYSEG_SIZE,
|
||||
disk_pos_assert(disk_pos + share->keyinfo[i].keysegs * HA_KEYSEG_SIZE,
|
||||
end_pos);
|
||||
if (share->keyinfo[i].key_alg == HA_KEY_ALG_RTREE)
|
||||
have_rtree=1;
|
||||
@ -373,7 +373,7 @@ MI_INFO *mi_open(const char *name, int mode, uint open_flags)
|
||||
{
|
||||
disk_pos=mi_uniquedef_read(disk_pos, &share->uniqueinfo[i]);
|
||||
disk_pos_assert(disk_pos + share->uniqueinfo[i].keysegs *
|
||||
MI_KEYSEG_SIZE, end_pos);
|
||||
HA_KEYSEG_SIZE, end_pos);
|
||||
share->uniqueinfo[i].seg=pos;
|
||||
for (j=0 ; j < share->uniqueinfo[i].keysegs; j++,pos++)
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (i int, j int);
|
||||
insert into t1 values (1,2), (3,4), (5,6), (7,8);
|
||||
create table t1 (i int, j int, empty_string char(10), bool char(1), d date);
|
||||
insert into t1 values (1,2,"","Y","2002-03-03"), (3,4,"","N","2002-03-04"), (5,6,"","Y","2002-03-04"), (7,8,"","N","2002-03-05");
|
||||
select count(*) from t1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
count(*) 4 4 1 1 0 0 4.0000 0.0000 ENUM('4') NOT NULL
|
||||
@ -8,11 +8,24 @@ select * from t1 procedure analyse();
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
|
||||
t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
|
||||
t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
|
||||
t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
||||
t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
select * from t1 procedure analyse(2);
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
t1.i 1 7 1 1 0 0 4.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
|
||||
t1.j 2 8 1 1 0 0 5.0000 2.2361 TINYINT(1) UNSIGNED NOT NULL
|
||||
t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
|
||||
t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
||||
t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
create table t2 select * from t1 procedure analyse();
|
||||
select * from t2;
|
||||
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
|
||||
t1.i 1 7 1 1 0 0 4.0000 2.2361 ENUM('1','3','5','7') NOT NULL
|
||||
t1.j 2 8 1 1 0 0 5.0000 2.2361 ENUM('2','4','6','8') NOT NULL
|
||||
t1.empty_string 0 0 4 0 0.0000 NULL CHAR(0) NOT NULL
|
||||
t1.bool N Y 1 1 0 0 1.0000 NULL ENUM('N','Y') NOT NULL
|
||||
t1.d 2002-03-03 2002-03-05 10 10 0 0 10.0000 NULL ENUM('2002-03-03','2002-03-04','2002-03-05') NOT NULL
|
||||
drop table t1,t2;
|
||||
EXPLAIN SELECT 1 FROM (SELECT 1) a PROCEDURE ANALYSE();
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
|
@ -1,20 +1,25 @@
|
||||
set SQL_LOG_BIN=0;
|
||||
drop table if exists t1, t2, t3;
|
||||
create table t1(n int);
|
||||
backup table t1 to '../bogus';
|
||||
create table t4(n int);
|
||||
backup table t4 to '../bogus';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 backup error Failed copying .frm file: errno = X
|
||||
test.t1 backup status Operation failed
|
||||
backup table t1 to '../tmp';
|
||||
test.t4 backup error Failed copying .frm file (errno: X)
|
||||
test.t4 backup status Operation failed
|
||||
backup table t4 to '../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 backup status OK
|
||||
drop table t1;
|
||||
restore table t1 from '../tmp';
|
||||
test.t4 backup status OK
|
||||
backup table t4 to '../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore status OK
|
||||
select count(*) from t1;
|
||||
test.t4 backup error Failed copying .frm file (errno: X)
|
||||
test.t4 backup status Operation failed
|
||||
drop table t4;
|
||||
restore table t4 from '../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t4 restore status OK
|
||||
select count(*) from t4;
|
||||
count(*)
|
||||
0
|
||||
create table t1(n int);
|
||||
insert into t1 values (23),(45),(67);
|
||||
backup table t1 to '../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
@ -35,9 +40,8 @@ create table t2(m int not null primary key);
|
||||
create table t3(k int not null primary key);
|
||||
insert into t2 values (123),(145),(167);
|
||||
insert into t3 values (223),(245),(267);
|
||||
backup table t1,t2,t3 to '../tmp';
|
||||
backup table t2,t3 to '../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 backup status OK
|
||||
test.t2 backup status OK
|
||||
test.t3 backup status OK
|
||||
drop table t1,t2,t3;
|
||||
@ -61,13 +65,14 @@ k
|
||||
223
|
||||
245
|
||||
267
|
||||
drop table t1,t2,t3;
|
||||
drop table t1,t2,t3,t4;
|
||||
restore table t1 from '../tmp';
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 restore status OK
|
||||
lock tables t1 write;
|
||||
backup table t1 to '../tmp';
|
||||
rename table t1 to t5;
|
||||
lock tables t5 write;
|
||||
backup table t5 to '../tmp';
|
||||
unlock tables;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 backup status OK
|
||||
drop table t1;
|
||||
test.t5 backup status OK
|
||||
drop table t5;
|
||||
|
@ -69,6 +69,8 @@ Incorrect table name ''
|
||||
create table t1 (`` int);
|
||||
Incorrect column name ''
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
create table t1 (a int auto_increment not null primary key, B CHAR(20));
|
||||
insert into t1 (b) values ("hello"),("my"),("world");
|
||||
create table t2 (key (b)) select * from t1;
|
||||
|
@ -24,14 +24,14 @@ create table t1 (a bigint not null, primary key (a,a,a,a,a,a,a,a,a,a));
|
||||
insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(26),(23),(27);
|
||||
delete from t1 where a=27;
|
||||
drop table t1;
|
||||
CREATE TABLE `t` (
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(10) NOT NULL default '0',
|
||||
`i2` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`i`)
|
||||
) TYPE=MyISAM CHARSET=latin1;
|
||||
DELETE FROM t USING t WHERE post='1';
|
||||
);
|
||||
DELETE FROM t1 USING t1 WHERE post='1';
|
||||
Unknown column 'post' in 'where clause'
|
||||
drop table if exists t;
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
bool char(0) default NULL,
|
||||
not_null varchar(20) binary NOT NULL default '',
|
||||
|
@ -2,11 +2,11 @@ drop table if exists t1;
|
||||
create table t1 (a varchar(10), key(a));
|
||||
insert into t1 values ("a"),("abc"),("abcd"),("hello"),("test");
|
||||
explain select * from t1 where a like 'abc%';
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 range a a 11 NULL 1 Using where; Using index
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 11 NULL 1 Using where; Using index
|
||||
explain select * from t1 where a like concat('abc','%');
|
||||
table type possible_keys key key_len ref rows Extra
|
||||
t1 range a a 11 NULL 1 Using where; Using index
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range a a 11 NULL 1 Using where; Using index
|
||||
select * from t1 where a like "abc%";
|
||||
a
|
||||
abc
|
||||
|
@ -1074,6 +1074,9 @@ select * from t2;
|
||||
id t1_id
|
||||
drop table t1,t2;
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
Note 1051 Unknown table 't2'
|
||||
CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
|
||||
CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) TYPE=INNODB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
@ -1,9 +1,9 @@
|
||||
slave stop;
|
||||
stop slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
start slave;
|
||||
create table t1(a int);
|
||||
select * into outfile '../../var/master-data/rpl_loaddatalocal.select_outfile' from t1;
|
||||
truncate table t1;
|
||||
|
@ -96,8 +96,8 @@ insert t1 values (0,0,0,0,0,0,0),
|
||||
"1997-12-31 23:47:59");
|
||||
select * from t1;
|
||||
t2 t4 t6 t8 t10 t12 t14
|
||||
00 0000 000000 00000000 0000000000 000000000000 00000000000000
|
||||
97 9712 971231 19971231 9712312347 971231234759 19971231234759
|
||||
0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00 0000-00-00 00:00:00
|
||||
1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59 1997-12-31 23:47:59
|
||||
set new=1;
|
||||
select * from t1;
|
||||
t2 t4 t6 t8 t10 t12 t14
|
||||
|
@ -38,14 +38,14 @@ insert into t1 values (2),(4),(6),(8),(10),(12),(14),(16),(18),(20),(22),(24),(2
|
||||
delete from t1 where a=27;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE `t` (
|
||||
CREATE TABLE `t1` (
|
||||
`i` int(10) NOT NULL default '0',
|
||||
`i2` int(10) NOT NULL default '0',
|
||||
PRIMARY KEY (`i`)
|
||||
) TYPE=MyISAM CHARSET=latin1;
|
||||
);
|
||||
-- error 1054
|
||||
DELETE FROM t USING t WHERE post='1';
|
||||
drop table if exists t;
|
||||
DELETE FROM t1 USING t1 WHERE post='1';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# CHAR(0) bug - not actually DELETE bug, but anyway...
|
||||
|
@ -680,6 +680,7 @@ public:
|
||||
{
|
||||
is_fatal_error= 1;
|
||||
net.report_error= 1;
|
||||
DBUG_PRINT("error",("Fatal error set"));
|
||||
}
|
||||
inline CHARSET_INFO *charset() { return variables.thd_charset; }
|
||||
};
|
||||
@ -907,10 +908,11 @@ class Table_ident :public Sql_alloc
|
||||
LEX_STRING db;
|
||||
LEX_STRING table;
|
||||
SELECT_LEX_UNIT *sel;
|
||||
inline Table_ident(LEX_STRING db_arg, LEX_STRING table_arg, bool force)
|
||||
inline Table_ident(THD *thd, LEX_STRING db_arg, LEX_STRING table_arg,
|
||||
bool force)
|
||||
:table(table_arg), sel((SELECT_LEX_UNIT *)0)
|
||||
{
|
||||
if (!force && (current_thd->client_capabilities & CLIENT_NO_SCHEMA))
|
||||
if (!force && (thd->client_capabilities & CLIENT_NO_SCHEMA))
|
||||
db.str=0;
|
||||
else
|
||||
db= db_arg;
|
||||
@ -922,7 +924,8 @@ class Table_ident :public Sql_alloc
|
||||
}
|
||||
inline Table_ident(SELECT_LEX_UNIT *s) : sel(s)
|
||||
{
|
||||
db.str=0; table.str=(char *)""; table.length=0;
|
||||
/* We must have a table name here as this is used with add_table_to_list */
|
||||
db.str=0; table.str=(char *)"*"; table.length=1;
|
||||
}
|
||||
inline void change_db(char *db_name)
|
||||
{
|
||||
|
@ -167,11 +167,13 @@ int mysql_derived(THD *thd, LEX *lex, SELECT_LEX_UNIT *unit,
|
||||
(TABLE_LIST*) select_cursor->table_list.first,
|
||||
select_cursor->with_wild,
|
||||
select_cursor->item_list, select_cursor->where,
|
||||
select_cursor->order_list.elements+select_cursor->group_list.elements,
|
||||
(select_cursor->order_list.elements+
|
||||
select_cursor->group_list.elements),
|
||||
(ORDER *) select_cursor->order_list.first,
|
||||
(ORDER *) select_cursor->group_list.first,
|
||||
select_cursor->having, (ORDER*) NULL,
|
||||
select_cursor->options | thd->options | SELECT_NO_UNLOCK,
|
||||
(select_cursor->options | thd->options |
|
||||
SELECT_NO_UNLOCK),
|
||||
derived_result, unit, select_cursor, 1);
|
||||
|
||||
if (!res)
|
||||
|
@ -1275,7 +1275,7 @@ JOIN::cleanup(THD *thd)
|
||||
}
|
||||
}
|
||||
tmp_join->tmp_join= 0;
|
||||
return tmp_join->cleanup(thd);
|
||||
DBUG_RETURN(tmp_join->cleanup(thd));
|
||||
}
|
||||
|
||||
|
||||
@ -3812,7 +3812,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
|
||||
}
|
||||
}
|
||||
if (should_fix_fields)
|
||||
cond->fix_fields(current_thd,0);
|
||||
cond->fix_fields(current_thd,0, &cond);
|
||||
|
||||
if (!((Item_cond*) cond)->argument_list()->elements ||
|
||||
*cond_value != Item::COND_OK)
|
||||
|
@ -3399,7 +3399,8 @@ table_wild_one:
|
||||
}
|
||||
| ident '.' ident opt_wild opt_table_alias
|
||||
{
|
||||
if (!Select->add_table_to_list(YYTHD, new Table_ident($1, $3, 0),
|
||||
if (!Select->add_table_to_list(YYTHD,
|
||||
new Table_ident(YYTHD, $1, $3, 0),
|
||||
$5, TL_OPTION_UPDATING,
|
||||
Lex->lock_option))
|
||||
YYABORT;
|
||||
@ -3953,7 +3954,7 @@ field_ident:
|
||||
|
||||
table_ident:
|
||||
ident { $$=new Table_ident($1); }
|
||||
| ident '.' ident { $$=new Table_ident($1,$3,0);}
|
||||
| ident '.' ident { $$=new Table_ident(YYTHD, $1,$3,0);}
|
||||
| '.' ident { $$=new Table_ident($2);}
|
||||
/* For Delphi */;
|
||||
|
||||
|
Reference in New Issue
Block a user