mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/Users/kent/mysql/bk/mysql-4.1
This commit is contained in:
@@ -147,8 +147,10 @@ byte ft_get_word(CHARSET_INFO *cs, byte **start, byte *end,
|
|||||||
for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc), doc+=(mbl ? mbl : 1))
|
for (word->pos=doc; doc<end; length++, mbl=my_mbcharlen(cs, *(uchar *)doc), doc+=(mbl ? mbl : 1))
|
||||||
if (true_word_char(cs,*doc))
|
if (true_word_char(cs,*doc))
|
||||||
mwc=0;
|
mwc=0;
|
||||||
else if (!misc_word_char(*doc) || mwc++)
|
else if (!misc_word_char(*doc) || mwc)
|
||||||
break;
|
break;
|
||||||
|
else
|
||||||
|
mwc++;
|
||||||
|
|
||||||
param->prev='A'; /* be sure *prev is true_word_char */
|
param->prev='A'; /* be sure *prev is true_word_char */
|
||||||
word->len= (uint)(doc-word->pos) - mwc;
|
word->len= (uint)(doc-word->pos) - mwc;
|
||||||
|
@@ -432,4 +432,7 @@ INSERT INTO t1 VALUES('testword\'\'');
|
|||||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||||
a
|
a
|
||||||
testword''
|
testword''
|
||||||
|
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
|
||||||
|
a
|
||||||
|
testword''
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
@@ -179,7 +179,7 @@ a b c
|
|||||||
2 two two
|
2 two two
|
||||||
alter table t1 drop index c;
|
alter table t1 drop index c;
|
||||||
select * from t1 where b = 'two';
|
select * from t1 where b = 'two';
|
||||||
ERROR HY000: Table definition has changed, please retry transaction
|
ERROR HY000: Can't lock file (errno: 241)
|
||||||
select * from t1 where b = 'two';
|
select * from t1 where b = 'two';
|
||||||
a b c
|
a b c
|
||||||
2 two two
|
2 two two
|
||||||
|
@@ -699,3 +699,22 @@ execute stmt;
|
|||||||
@@tx_isolation
|
@@tx_isolation
|
||||||
REPEATABLE-READ
|
REPEATABLE-READ
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
|
prepare stmt from "create temporary table t1 (letter enum('','a','b','c')
|
||||||
|
not null)";
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
set names latin1;
|
||||||
|
prepare stmt from "create table t1 (a enum('test') default 'test')
|
||||||
|
character set utf8";
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
set names default;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
@@ -2706,3 +2706,11 @@ select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
|
|||||||
count(f2) >0
|
count(f2) >0
|
||||||
1
|
1
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
create table t1 (f1 int,f2 int);
|
||||||
|
insert into t1 values(1,1);
|
||||||
|
create table t2 (f3 int, f4 int, primary key(f3,f4));
|
||||||
|
insert into t2 values(1,1);
|
||||||
|
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
|
||||||
|
f1 f2
|
||||||
|
1 1
|
||||||
|
drop table t1,t2;
|
||||||
|
@@ -354,6 +354,7 @@ SET myisam_repair_threads=@@global.myisam_repair_threads;
|
|||||||
#
|
#
|
||||||
INSERT INTO t1 VALUES('testword\'\'');
|
INSERT INTO t1 VALUES('testword\'\'');
|
||||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||||
|
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@@ -149,7 +149,7 @@ connection server1;
|
|||||||
alter table t1 drop index c;
|
alter table t1 drop index c;
|
||||||
connection server2;
|
connection server2;
|
||||||
# This should fail since index information is not automatically refreshed
|
# This should fail since index information is not automatically refreshed
|
||||||
--error 1105
|
--error 1015
|
||||||
select * from t1 where b = 'two';
|
select * from t1 where b = 'two';
|
||||||
select * from t1 where b = 'two';
|
select * from t1 where b = 'two';
|
||||||
connection server1;
|
connection server1;
|
||||||
|
@@ -718,4 +718,33 @@ set @@tx_isolation=default;
|
|||||||
execute stmt;
|
execute stmt;
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP"
|
||||||
|
#
|
||||||
|
# Part I. Make sure the typelib for ENUM is created in the statement memory
|
||||||
|
# root.
|
||||||
|
prepare stmt from "create temporary table t1 (letter enum('','a','b','c')
|
||||||
|
not null)";
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
# Part II. Make sure that when the default value is converted to UTF-8,
|
||||||
|
# the new item is # created in the statement memory root.
|
||||||
|
set names latin1;
|
||||||
|
prepare stmt from "create table t1 (a enum('test') default 'test')
|
||||||
|
character set utf8";
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
drop table t1;
|
||||||
|
# Cleanup
|
||||||
|
set names default;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
|
||||||
|
@@ -2237,4 +2237,15 @@ insert into t1 values (1,1);
|
|||||||
insert into t2 values (1,1),(1,2);
|
insert into t2 values (1,1),(1,2);
|
||||||
select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
|
select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug #14482 Server crash when subselecting from the same table
|
||||||
|
#
|
||||||
|
create table t1 (f1 int,f2 int);
|
||||||
|
insert into t1 values(1,1);
|
||||||
|
create table t2 (f3 int, f4 int, primary key(f3,f4));
|
||||||
|
insert into t2 values(1,1);
|
||||||
|
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
|
||||||
|
drop table t1,t2;
|
||||||
|
|
||||||
# End of 4.1 tests
|
# End of 4.1 tests
|
||||||
|
@@ -3285,12 +3285,7 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||||||
DBUG_PRINT("info", ("Table schema version: %d",
|
DBUG_PRINT("info", ("Table schema version: %d",
|
||||||
tab->getObjectVersion()));
|
tab->getObjectVersion()));
|
||||||
}
|
}
|
||||||
if (m_table != (void *)tab)
|
if (m_table_version < tab->getObjectVersion())
|
||||||
{
|
|
||||||
m_table= (void *)tab;
|
|
||||||
m_table_version = tab->getObjectVersion();
|
|
||||||
}
|
|
||||||
else if (m_table_version < tab->getObjectVersion())
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The table has been altered, caller has to retry
|
The table has been altered, caller has to retry
|
||||||
@@ -3298,6 +3293,13 @@ int ha_ndbcluster::external_lock(THD *thd, int lock_type)
|
|||||||
NdbError err= ndb->getNdbError(NDB_INVALID_SCHEMA_OBJECT);
|
NdbError err= ndb->getNdbError(NDB_INVALID_SCHEMA_OBJECT);
|
||||||
DBUG_RETURN(ndb_to_mysql_error(&err));
|
DBUG_RETURN(ndb_to_mysql_error(&err));
|
||||||
}
|
}
|
||||||
|
if (m_table != (void *)tab)
|
||||||
|
{
|
||||||
|
m_table= (void *)tab;
|
||||||
|
m_table_version = tab->getObjectVersion();
|
||||||
|
if (!(my_errno= build_index_list(ndb, table, ILBP_OPEN)))
|
||||||
|
DBUG_RETURN(my_errno);
|
||||||
|
}
|
||||||
m_table_info= tab_info;
|
m_table_info= tab_info;
|
||||||
}
|
}
|
||||||
no_uncommitted_rows_init(thd);
|
no_uncommitted_rows_init(thd);
|
||||||
|
15
sql/item.cc
15
sql/item.cc
@@ -2863,7 +2863,7 @@ Item_result item_cmp_type(Item_result a,Item_result b)
|
|||||||
void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
||||||
{
|
{
|
||||||
Item *item= *ref;
|
Item *item= *ref;
|
||||||
Item *new_item;
|
Item *new_item= NULL;
|
||||||
if (item->basic_const_item())
|
if (item->basic_const_item())
|
||||||
return; // Can't be better
|
return; // Can't be better
|
||||||
Item_result res_type=item_cmp_type(comp_item->result_type(),
|
Item_result res_type=item_cmp_type(comp_item->result_type(),
|
||||||
@@ -2892,8 +2892,17 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
|||||||
new_item= (null_value ? (Item*) new Item_null(name) :
|
new_item= (null_value ? (Item*) new Item_null(name) :
|
||||||
(Item*) new Item_int(name, result, length));
|
(Item*) new Item_int(name, result, length));
|
||||||
}
|
}
|
||||||
else if (res_type == ROW_RESULT)
|
else if (res_type == ROW_RESULT && item->type() == Item::ROW_ITEM &&
|
||||||
|
comp_item->type() == Item::ROW_ITEM)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
Substitute constants only in Item_rows. Don't affect other Items
|
||||||
|
with ROW_RESULT (eg Item_singlerow_subselect).
|
||||||
|
|
||||||
|
For such Items more optimal is to detect if it is constant and replace
|
||||||
|
it with Item_row. This would optimize queries like this:
|
||||||
|
SELECT * FROM t1 WHERE (a,b) = (SELECT a,b FROM t2 LIMIT 1);
|
||||||
|
*/
|
||||||
Item_row *item_row= (Item_row*) item;
|
Item_row *item_row= (Item_row*) item;
|
||||||
Item_row *comp_item_row= (Item_row*) comp_item;
|
Item_row *comp_item_row= (Item_row*) comp_item;
|
||||||
uint col;
|
uint col;
|
||||||
@@ -2910,7 +2919,7 @@ void resolve_const_item(THD *thd, Item **ref, Item *comp_item)
|
|||||||
while (col-- > 0)
|
while (col-- > 0)
|
||||||
resolve_const_item(thd, item_row->addr(col), comp_item_row->el(col));
|
resolve_const_item(thd, item_row->addr(col), comp_item_row->el(col));
|
||||||
}
|
}
|
||||||
else
|
else if (res_type == REAL_RESULT)
|
||||||
{ // It must REAL_RESULT
|
{ // It must REAL_RESULT
|
||||||
double result=item->val();
|
double result=item->val();
|
||||||
uint length=item->max_length,decimals=item->decimals;
|
uint length=item->max_length,decimals=item->decimals;
|
||||||
|
@@ -1119,7 +1119,7 @@ int calc_weekday(long daynr,bool sunday_first_day_of_week);
|
|||||||
uint calc_week(TIME *l_time, uint week_behaviour, uint *year);
|
uint calc_week(TIME *l_time, uint week_behaviour, uint *year);
|
||||||
void find_date(char *pos,uint *vek,uint flag);
|
void find_date(char *pos,uint *vek,uint flag);
|
||||||
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
|
TYPELIB *convert_strings_to_array_type(my_string *typelibs, my_string *end);
|
||||||
TYPELIB *typelib(List<String> &strings);
|
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings);
|
||||||
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
|
ulong get_form_pos(File file, uchar *head, TYPELIB *save_names);
|
||||||
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
|
ulong make_new_entry(File file,uchar *fileinfo,TYPELIB *formnames,
|
||||||
const char *newname);
|
const char *newname);
|
||||||
|
@@ -524,7 +524,14 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
*/
|
*/
|
||||||
if (!interval)
|
if (!interval)
|
||||||
{
|
{
|
||||||
interval= sql_field->interval= typelib(sql_field->interval_list);
|
/*
|
||||||
|
Create the typelib in prepared statement memory if we're
|
||||||
|
executing one.
|
||||||
|
*/
|
||||||
|
MEM_ROOT *stmt_root= thd->current_arena->mem_root;
|
||||||
|
|
||||||
|
interval= sql_field->interval= typelib(stmt_root,
|
||||||
|
sql_field->interval_list);
|
||||||
List_iterator<String> it(sql_field->interval_list);
|
List_iterator<String> it(sql_field->interval_list);
|
||||||
String conv, *tmp;
|
String conv, *tmp;
|
||||||
for (uint i= 0; (tmp= it++); i++)
|
for (uint i= 0; (tmp= it++); i++)
|
||||||
@@ -534,7 +541,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
{
|
{
|
||||||
uint cnv_errs;
|
uint cnv_errs;
|
||||||
conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs);
|
conv.copy(tmp->ptr(), tmp->length(), tmp->charset(), cs, &cnv_errs);
|
||||||
char *buf= (char*) sql_alloc(conv.length()+1);
|
char *buf= (char*) alloc_root(stmt_root, conv.length()+1);
|
||||||
memcpy(buf, conv.ptr(), conv.length());
|
memcpy(buf, conv.ptr(), conv.length());
|
||||||
buf[conv.length()]= '\0';
|
buf[conv.length()]= '\0';
|
||||||
interval->type_names[i]= buf;
|
interval->type_names[i]= buf;
|
||||||
@@ -556,8 +563,22 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
*/
|
*/
|
||||||
if (sql_field->def && cs != sql_field->def->collation.collation)
|
if (sql_field->def && cs != sql_field->def->collation.collation)
|
||||||
{
|
{
|
||||||
if (!(sql_field->def=
|
Item_arena backup_arena;
|
||||||
sql_field->def->safe_charset_converter(cs)))
|
bool need_to_change_arena=
|
||||||
|
!thd->current_arena->is_conventional_execution();
|
||||||
|
if (need_to_change_arena)
|
||||||
|
{
|
||||||
|
/* Asser that we don't do that at every PS execute */
|
||||||
|
DBUG_ASSERT(thd->current_arena->is_first_stmt_execute());
|
||||||
|
thd->set_n_backup_item_arena(thd->current_arena, &backup_arena);
|
||||||
|
}
|
||||||
|
|
||||||
|
sql_field->def= sql_field->def->safe_charset_converter(cs);
|
||||||
|
|
||||||
|
if (need_to_change_arena)
|
||||||
|
thd->restore_backup_item_arena(thd->current_arena, &backup_arena);
|
||||||
|
|
||||||
|
if (! sql_field->def)
|
||||||
{
|
{
|
||||||
/* Could not convert */
|
/* Could not convert */
|
||||||
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
|
my_error(ER_INVALID_DEFAULT, MYF(0), sql_field->field_name);
|
||||||
|
@@ -1099,15 +1099,15 @@ fix_type_pointers(const char ***array, TYPELIB *point_to_type, uint types,
|
|||||||
} /* fix_type_pointers */
|
} /* fix_type_pointers */
|
||||||
|
|
||||||
|
|
||||||
TYPELIB *typelib(List<String> &strings)
|
TYPELIB *typelib(MEM_ROOT *mem_root, List<String> &strings)
|
||||||
{
|
{
|
||||||
TYPELIB *result=(TYPELIB*) sql_alloc(sizeof(TYPELIB));
|
TYPELIB *result= (TYPELIB*) alloc_root(mem_root, sizeof(TYPELIB));
|
||||||
if (!result)
|
if (!result)
|
||||||
return 0;
|
return 0;
|
||||||
result->count=strings.elements;
|
result->count=strings.elements;
|
||||||
result->name="";
|
result->name="";
|
||||||
uint nbytes= (sizeof(char*) + sizeof(uint)) * (result->count + 1);
|
uint nbytes= (sizeof(char*) + sizeof(uint)) * (result->count + 1);
|
||||||
if (!(result->type_names= (const char**) sql_alloc(nbytes)))
|
if (!(result->type_names= (const char**) alloc_root(mem_root, nbytes)))
|
||||||
return 0;
|
return 0;
|
||||||
result->type_lengths= (uint*) (result->type_names + result->count + 1);
|
result->type_lengths= (uint*) (result->type_names + result->count + 1);
|
||||||
List_iterator<String> it(strings);
|
List_iterator<String> it(strings);
|
||||||
|
@@ -491,7 +491,6 @@ then
|
|||||||
if test -x %{_sysconfdir}/init.d/mysql
|
if test -x %{_sysconfdir}/init.d/mysql
|
||||||
then
|
then
|
||||||
%{_sysconfdir}/init.d/mysql stop > /dev/null
|
%{_sysconfdir}/init.d/mysql stop > /dev/null
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove autostart of mysql
|
# Remove autostart of mysql
|
||||||
# for older SuSE Linux versions
|
# for older SuSE Linux versions
|
||||||
@@ -503,6 +502,7 @@ then
|
|||||||
then
|
then
|
||||||
/sbin/chkconfig --del mysql
|
/sbin/chkconfig --del mysql
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# We do not remove the mysql user since it may still own a lot of
|
# We do not remove the mysql user since it may still own a lot of
|
||||||
@@ -689,6 +689,11 @@ fi
|
|||||||
# itself - note that they must be ordered by date (important when
|
# itself - note that they must be ordered by date (important when
|
||||||
# merging BK trees)
|
# merging BK trees)
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Nov 22 2005 Joerg Bruehe <joerg@mysql.com>
|
||||||
|
|
||||||
|
- Extend the file existence check for "init.d/mysql" on un-install
|
||||||
|
to also guard the call to "insserv"/"chkconfig".
|
||||||
|
|
||||||
* Thu Oct 27 2005 Lenz Grimmer <lenz@grimmer.com>
|
* Thu Oct 27 2005 Lenz Grimmer <lenz@grimmer.com>
|
||||||
|
|
||||||
- added more man pages
|
- added more man pages
|
||||||
|
Reference in New Issue
Block a user