Commit 19809fab authored by unknown's avatar unknown

Merge spachev@bk-internal.mysql.com:/home/bk/mysql-4.1

into  asksasha.com:/reiser-data/mysql-dev/mysql-4.1-bug7947

parents 4b1cb988 69fae29c
......@@ -188,8 +188,10 @@ byte ft_simple_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))
if (true_word_char(cs,*doc))
mwc= 0;
else if (!misc_word_char(*doc) || mwc++)
else if (!misc_word_char(*doc) || mwc)
break;
else
mwc++;
word->len= (uint)(doc-word->pos) - mwc;
......
......@@ -217,7 +217,10 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
{
k_length-=length;
if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART))
{
old+= 2;
k_length-=2; /* Skip length */
}
continue; /* Found NULL */
}
}
......
......@@ -30,3 +30,10 @@ check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
drop table t1;
CREATE TABLE t1 (a int);
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
execute stmt1;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
execute stmt1;
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
deallocate prepare stmt1;
drop table if exists t1,t2,t3;
drop table if exists t1,t2,t3,t4,t5;
drop database if exists mysqltest;
create table t1 (b char(0));
insert into t1 values (""),(null);
......@@ -632,3 +632,80 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
CREATE TABLE t2 (
a int(11) default NULL
);
insert into t2 values(111);
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select a, 1 as b from t2 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
`b` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
`b` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin,
b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` varchar(12) character set utf8 collate utf8_bin NOT NULL default '',
`b` int(11) NOT NULL default '0',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
create table t1 (
a1 int not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
);
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
drop table t2;
create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1;
drop table t1, t2;
create table t1 (
a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
);
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
drop table t2;
create table t2 ( a int default 3, b int default 3)
select a1,a2 from t1;
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) default '3',
`b` int(11) default '3',
`a1` int(11) default NULL,
`a2` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
......@@ -428,4 +428,8 @@ REPAIR TABLE t1;
Table Op Msg_type Msg_text
test.t1 repair status OK
SET myisam_repair_threads=@@global.myisam_repair_threads;
INSERT INTO t1 VALUES('testword\'\'');
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
a
testword''
DROP TABLE t1;
......@@ -702,3 +702,21 @@ t1 1 a 2 b A 0 NULL NULL YES BTREE
t1 1 a 3 c A 0 NULL NULL YES BTREE
t1 1 a 4 d A 0 NULL NULL YES BTREE
set myisam_stats_method=DEFAULT;
drop table t1;
create table t1(
cip INT NOT NULL,
time TIME NOT NULL,
score INT NOT NULL DEFAULT 0,
bob TINYBLOB
);
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'),
(6, 'c', '00:06');
select * from t1 where bob is null and cip=1;
cip time score bob
1 00:01:00 0 NULL
create index bug on t1 (bob(22), cip, time);
select * from t1 where bob is null and cip=1;
cip time score bob
1 00:01:00 0 NULL
drop table t1;
......@@ -39,4 +39,13 @@ check table t1;
drop table t1;
#
# procedure in PS BUG#13673
#
CREATE TABLE t1 (a int);
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
execute stmt1;
execute stmt1;
deallocate prepare stmt1;
# End of 4.1 tests
......@@ -3,7 +3,7 @@
#
--disable_warnings
drop table if exists t1,t2,t3;
drop table if exists t1,t2,t3,t4,t5;
drop database if exists mysqltest;
--enable_warnings
......@@ -534,4 +534,73 @@ create table t1 (
show create table t1;
drop table t1;
#
# BUG#14480: assert failure in CREATE ... SELECT because of wrong
# calculation of number of NULLs.
#
CREATE TABLE t2 (
a int(11) default NULL
);
insert into t2 values(111);
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select a, 1 as b from t2 ;
show create table t1;
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin not null,
b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
show create table t1;
drop table t1;
create table t1 (
a varchar(12) charset utf8 collate utf8_bin,
b int not null, primary key (a)
) select 'a' as a , 1 as b from t2 ;
show create table t1;
drop table t1, t2;
create table t1 (
a1 int not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
);
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
drop table t2;
create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1;
drop table t1, t2;
create table t1 (
a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int
);
insert into t1 values (1,1,1, 1,1,1, 1,1,1);
create table t2 (
a1 varchar(12) charset utf8 collate utf8_bin not null,
a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int,
primary key (a1)
) select a1,a2,a3,a4,a5,a6,a7,a8,a9 from t1 ;
# Test the default value
drop table t2;
create table t2 ( a int default 3, b int default 3)
select a1,a2 from t1;
show create table t2;
drop table t1, t2;
# End of 4.1 tests
......@@ -348,6 +348,12 @@ INSERT INTO t1 VALUES('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
SET myisam_repair_threads=2;
REPAIR TABLE t1;
SET myisam_repair_threads=@@global.myisam_repair_threads;
#
# BUG#5686 - #1034 - Incorrect key file for table - only utf8
#
INSERT INTO t1 VALUES('testword\'\'');
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
DROP TABLE t1;
# End of 4.1 tests
......@@ -656,4 +656,22 @@ analyze table t1;
show index from t1;
set myisam_stats_method=DEFAULT;
drop table t1;
# BUG#13814 - key value packed incorrectly for TINYBLOBs
create table t1(
cip INT NOT NULL,
time TIME NOT NULL,
score INT NOT NULL DEFAULT 0,
bob TINYBLOB
);
insert into t1 (cip, time) VALUES (1, '00:01'), (2, '00:02'), (3,'00:03');
insert into t1 (cip, bob, time) VALUES (4, 'a', '00:04'), (5, 'b', '00:05'),
(6, 'c', '00:06');
select * from t1 where bob is null and cip=1;
create index bug on t1 (bob(22), cip, time);
select * from t1 where bob is null and cip=1;
drop table t1;
# End of 4.1 tests
......@@ -29,7 +29,7 @@ ALTER TABLE user add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,a
ALTER TABLE host add Grant_priv enum('N','Y') NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
ALTER TABLE db add Grant_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add References_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Index_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL,add Alter_priv enum('N','Y') COLLATE utf8_general_ci NOT NULL;
--- Fix privileges for old tables
-- Fix privileges for old tables
UPDATE user SET Grant_priv=File_priv,References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
UPDATE db SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
UPDATE host SET References_priv=Create_priv,Index_priv=Create_priv,Alter_priv=Create_priv WHERE @hadGrantPriv = 0;
......
......@@ -938,7 +938,6 @@ class user_var_entry;
class Item_func_set_user_var :public Item_func
{
enum Item_result cached_result_type;
LEX_STRING name;
user_var_entry *entry;
char buffer[MAX_FIELD_WIDTH];
String value;
......@@ -952,6 +951,7 @@ class Item_func_set_user_var :public Item_func
public:
LEX_STRING name; // keep it public
Item_func_set_user_var(LEX_STRING a,Item *b)
:Item_func(b), cached_result_type(INT_RESULT), name(a)
{}
......@@ -972,10 +972,10 @@ class Item_func_set_user_var :public Item_func
class Item_func_get_user_var :public Item_func
{
LEX_STRING name;
user_var_entry *var_entry;
public:
LEX_STRING name; // keep it public
Item_func_get_user_var(LEX_STRING a):
Item_func(), name(a) {}
double val();
......
......@@ -614,8 +614,8 @@ class Item_func_quote :public Item_str_func
class Item_func_conv_charset :public Item_str_func
{
CHARSET_INFO *conv_charset;
public:
CHARSET_INFO *conv_charset; // keep it public
Item_func_conv_charset(Item *a, CHARSET_INFO *cs) :Item_str_func(a)
{ conv_charset=cs; }
String *val_str(String *);
......
......@@ -607,12 +607,12 @@ enum interval_type
class Item_date_add_interval :public Item_date_func
{
const interval_type int_type;
String value;
const bool date_sub_interval;
enum_field_types cached_field_type;
public:
const interval_type int_type; // keep it public
const bool date_sub_interval; // keep it public
Item_date_add_interval(Item *a,Item *b,interval_type type_arg,bool neg_arg)
:Item_date_func(a,b),int_type(type_arg), date_sub_interval(neg_arg) {}
String *val_str(String *);
......@@ -628,10 +628,10 @@ class Item_date_add_interval :public Item_date_func
class Item_extract :public Item_int_func
{
const interval_type int_type;
String value;
bool date_value;
public:
const interval_type int_type; // keep it public
Item_extract(interval_type type_arg, Item *a)
:Item_int_func(a), int_type(type_arg) {}
longlong val_int();
......@@ -856,8 +856,8 @@ enum date_time_format
class Item_func_get_format :public Item_str_func
{
const timestamp_type type;
public:
const timestamp_type type; // keep it public
Item_func_get_format(timestamp_type type_arg, Item *a)
:Item_str_func(a), type(type_arg)
{}
......
......@@ -639,6 +639,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
else
{
/* Field redefined */
sql_field->def= dup_field->def;
sql_field->sql_type= dup_field->sql_type;
sql_field->charset= (dup_field->charset ?
dup_field->charset :
......@@ -647,8 +648,15 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->pack_length= dup_field->pack_length;
sql_field->create_length_to_internal_length();
sql_field->decimals= dup_field->decimals;
sql_field->flags= dup_field->flags;
sql_field->unireg_check= dup_field->unireg_check;
/*
We're making one field from two, the result field will have
dup_field->flags as flags. If we've incremented null_fields
because of sql_field->flags, decrement it back.
*/
if (!(sql_field->flags & NOT_NULL_FLAG))
null_fields--;
sql_field->flags= dup_field->flags;
it2.remove(); // Remove first (create) definition
select_field_pos--;
break;
......
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