summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-03-17 15:05:04 +0200
committerunknown <monty@narttu.mysql.fi>2003-03-17 15:05:04 +0200
commit6a44ee4d0f87bbfd8e134527f986b1d86fd11ecc (patch)
tree7762c42e75102f122a8c9f5423ed0b676d5430a4
parent4b3b8d3724f1eab648f51ecba3919d6ec51f0104 (diff)
downloadmariadb-git-6a44ee4d0f87bbfd8e134527f986b1d86fd11ecc.tar.gz
After merge fixes
Don't create temporary objects with no table name myisam/mi_open.c: After merge fix mysql-test/r/analyse.result: After merge fix mysql-test/r/backup.result: After merge fix mysql-test/r/create.result: After merge fix mysql-test/r/delete.result: After merge fix mysql-test/r/func_like.result: After merge fix mysql-test/r/innodb.result: After merge fix mysql-test/r/rpl_loaddatalocal.result: After merge fix mysql-test/r/type_timestamp.result: After merge fix mysql-test/t/delete.test: Change to not use table 't' sql/sql_class.h: Remove usage of thd when creating 'Table_ident' Don't create temporary objects with no table name sql/sql_derived.cc: Indentation fix sql/sql_select.cc: After merge fix Fixed wrong return -> DBUG_RETURN() sql/sql_yacc.yy: Remove usage of thd when creating 'Table_ident'
-rw-r--r--myisam/mi_open.c4
-rw-r--r--mysql-test/r/analyse.result17
-rw-r--r--mysql-test/r/backup.result39
-rw-r--r--mysql-test/r/create.result2
-rw-r--r--mysql-test/r/delete.result8
-rw-r--r--mysql-test/r/func_like.result8
-rw-r--r--mysql-test/r/innodb.result3
-rw-r--r--mysql-test/r/rpl_loaddatalocal.result4
-rw-r--r--mysql-test/r/type_timestamp.result4
-rw-r--r--mysql-test/t/delete.test8
-rw-r--r--sql/sql_class.h9
-rw-r--r--sql/sql_derived.cc6
-rw-r--r--sql/sql_select.cc4
-rw-r--r--sql/sql_yacc.yy5
14 files changed, 75 insertions, 46 deletions
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index 26c8e503c28..a2602abea5d 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -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++)
{
diff --git a/mysql-test/r/analyse.result b/mysql-test/r/analyse.result
index 48882f42219..60764494417 100644
--- a/mysql-test/r/analyse.result
+++ b/mysql-test/r/analyse.result
@@ -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
diff --git a/mysql-test/r/backup.result b/mysql-test/r/backup.result
index e4f41517f94..e53c3c3eb55 100644
--- a/mysql-test/r/backup.result
+++ b/mysql-test/r/backup.result
@@ -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;
diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result
index 2ec2759ad7a..e061a78304f 100644
--- a/mysql-test/r/create.result
+++ b/mysql-test/r/create.result
@@ -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;
diff --git a/mysql-test/r/delete.result b/mysql-test/r/delete.result
index ee0c3ce1219..ae216f9b380 100644
--- a/mysql-test/r/delete.result
+++ b/mysql-test/r/delete.result
@@ -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 '',
diff --git a/mysql-test/r/func_like.result b/mysql-test/r/func_like.result
index f923c16b2ac..f90e694f5f0 100644
--- a/mysql-test/r/func_like.result
+++ b/mysql-test/r/func_like.result
@@ -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
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
index 0021be10d85..fd80ef785ea 100644
--- a/mysql-test/r/innodb.result
+++ b/mysql-test/r/innodb.result
@@ -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);
diff --git a/mysql-test/r/rpl_loaddatalocal.result b/mysql-test/r/rpl_loaddatalocal.result
index dc98b1b5bfb..b49ea842485 100644
--- a/mysql-test/r/rpl_loaddatalocal.result
+++ b/mysql-test/r/rpl_loaddatalocal.result
@@ -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;
diff --git a/mysql-test/r/type_timestamp.result b/mysql-test/r/type_timestamp.result
index 959c69ff6e7..0c75155146d 100644
--- a/mysql-test/r/type_timestamp.result
+++ b/mysql-test/r/type_timestamp.result
@@ -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
diff --git a/mysql-test/t/delete.test b/mysql-test/t/delete.test
index af047db04bd..91216ff9c3a 100644
--- a/mysql-test/t/delete.test
+++ b/mysql-test/t/delete.test
@@ -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...
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 079c095b2f5..44082aa897e 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -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)
{
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index f2cddeead2f..ca761140955 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -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)
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 50c666ab64e..987857fd61b 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -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)
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 7db398e7810..fe420549a59 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -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 */;