Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/home/kent/bk/tmp3/mysql-5.0-build
This commit is contained in:
commit
9d247f296a
@ -1086,7 +1086,12 @@ static int read_and_execute(bool interactive)
|
||||
something else is still in console input buffer
|
||||
*/
|
||||
} while (tmpbuf.alloced_length() <= clen);
|
||||
line= buffer.c_ptr();
|
||||
/*
|
||||
An empty line is returned from my_cgets when there's error reading :
|
||||
Ctrl-c for example
|
||||
*/
|
||||
if (line)
|
||||
line= buffer.c_ptr();
|
||||
#else /* OS2 */
|
||||
buffer.length(0);
|
||||
/* _cgets() expects the buffer size - 3 as the first byte */
|
||||
|
@ -3673,10 +3673,9 @@ static my_bool get_view_structure(char *table, char* db)
|
||||
result_table);
|
||||
check_io(sql_file);
|
||||
}
|
||||
fprintf(sql_file, "/*!50001 DROP TABLE %s*/;\n", opt_quoted_table);
|
||||
if (opt_drop)
|
||||
{
|
||||
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n",
|
||||
opt_quoted_table);
|
||||
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
|
||||
opt_quoted_table);
|
||||
check_io(sql_file);
|
||||
|
@ -284,6 +284,7 @@ enum ha_base_keytype {
|
||||
#define HA_PACK_RECORD 2 /* Request packed record format */
|
||||
#define HA_CREATE_TMP_TABLE 4
|
||||
#define HA_CREATE_CHECKSUM 8
|
||||
#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */
|
||||
#define HA_CREATE_DELAY_KEY_WRITE 64
|
||||
|
||||
/*
|
||||
|
@ -4945,7 +4945,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
|
||||
Reset stored result set if so was requested or it's a part
|
||||
of cursor fetch.
|
||||
*/
|
||||
if (result->data && (flags & RESET_STORE_RESULT))
|
||||
if (flags & RESET_STORE_RESULT)
|
||||
{
|
||||
/* Result buffered */
|
||||
free_root(&result->alloc, MYF(MY_KEEP_PREALLOC));
|
||||
|
@ -586,7 +586,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
||||
32 : 0));
|
||||
linkname_ptr=0;
|
||||
/* Replace the current file */
|
||||
create_flag=MY_DELETE_OLD;
|
||||
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -647,7 +647,7 @@ int mi_create(const char *name,uint keys,MI_KEYDEF *keydefs,
|
||||
{
|
||||
fn_format(filename,name,"",MI_NAME_DEXT,4);
|
||||
linkname_ptr=0;
|
||||
create_flag=MY_DELETE_OLD;
|
||||
create_flag=(flags & HA_CREATE_KEEP_FILES) ? 0 : MY_DELETE_OLD;
|
||||
}
|
||||
if ((dfile=
|
||||
my_create_with_symlink(linkname_ptr, filename, 0, create_mode,
|
||||
|
@ -31,11 +31,6 @@ static int sp_get_geometry_mbr(uchar *(*wkb), uchar *end, uint n_dims,
|
||||
double *mbr, int top);
|
||||
static int sp_mbr_from_wkb(uchar (*wkb), uint size, uint n_dims, double *mbr);
|
||||
|
||||
static void get_double(double *d, const byte *pos)
|
||||
{
|
||||
float8get(*d, pos);
|
||||
}
|
||||
|
||||
uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
||||
const byte *record, my_off_t filepos)
|
||||
{
|
||||
@ -62,48 +57,40 @@ uint sp_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
||||
|
||||
for (i = 0, keyseg = keyinfo->seg; keyseg->type; keyseg++, i++)
|
||||
{
|
||||
uint length = keyseg->length;
|
||||
uint length = keyseg->length, start= keyseg->start;
|
||||
double val;
|
||||
|
||||
DBUG_ASSERT(length == sizeof(double));
|
||||
DBUG_ASSERT(!(start % sizeof(double)));
|
||||
DBUG_ASSERT(start < sizeof(mbr));
|
||||
DBUG_ASSERT(keyseg->type == HA_KEYTYPE_DOUBLE);
|
||||
|
||||
pos = ((byte*)mbr) + keyseg->start;
|
||||
val= mbr[start / sizeof (double)];
|
||||
#ifdef HAVE_ISNAN
|
||||
if (isnan(val))
|
||||
{
|
||||
bzero(key, length);
|
||||
key+= length;
|
||||
len+= length;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (keyseg->flag & HA_SWAP_KEY)
|
||||
{
|
||||
#ifdef HAVE_ISNAN
|
||||
if (keyseg->type == HA_KEYTYPE_FLOAT)
|
||||
{
|
||||
float nr;
|
||||
float4get(nr, pos);
|
||||
if (isnan(nr))
|
||||
{
|
||||
/* Replace NAN with zero */
|
||||
bzero(key, length);
|
||||
key+= length;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (keyseg->type == HA_KEYTYPE_DOUBLE)
|
||||
{
|
||||
double nr;
|
||||
get_double(&nr, pos);
|
||||
if (isnan(nr))
|
||||
{
|
||||
bzero(key, length);
|
||||
key+= length;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
pos += length;
|
||||
while (length--)
|
||||
{
|
||||
char buf[sizeof(double)];
|
||||
|
||||
float8store(buf, val);
|
||||
pos= &buf[length];
|
||||
while (pos > buf)
|
||||
*key++ = *--pos;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy((byte*)key, pos, length);
|
||||
key += keyseg->length;
|
||||
float8store((byte *)key, val);
|
||||
key += length;
|
||||
}
|
||||
len += keyseg->length;
|
||||
len+= length;
|
||||
}
|
||||
_mi_dpointer(info, key, filepos);
|
||||
return len;
|
||||
@ -141,13 +128,13 @@ static int sp_add_point_to_mbr(uchar *(*wkb), uchar *end, uint n_dims,
|
||||
{
|
||||
if ((*wkb) > end - 8)
|
||||
return -1;
|
||||
get_double(&ord, (const byte*) *wkb);
|
||||
float8get(ord, (const byte*) *wkb);
|
||||
(*wkb)+= 8;
|
||||
if (ord < *mbr)
|
||||
float8store((char*) mbr, ord);
|
||||
*mbr= ord;
|
||||
mbr++;
|
||||
if (ord > *mbr)
|
||||
float8store((char*) mbr, ord);
|
||||
*mbr= ord;
|
||||
mbr++;
|
||||
}
|
||||
return 0;
|
||||
|
@ -403,4 +403,15 @@ hex(cast('a' as binary(2)))
|
||||
select hex(cast('a' as char(2) binary));
|
||||
hex(cast('a' as char(2) binary))
|
||||
61
|
||||
CREATE TABLE t1 (d1 datetime);
|
||||
INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
|
||||
('2007-07-19 08:34:00'), (NULL), ('2007-07-19 08:36:00');
|
||||
SELECT cast(date(d1) as signed) FROM t1;
|
||||
cast(date(d1) as signed)
|
||||
20070719
|
||||
NULL
|
||||
20070719
|
||||
NULL
|
||||
20070719
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -193,11 +193,13 @@ select hex(convert(_big5 0xC84041 using ucs2));
|
||||
hex(convert(_big5 0xC84041 using ucs2))
|
||||
003F0041
|
||||
End of 4.1 tests
|
||||
set names big5;
|
||||
create table t1 (a blob);
|
||||
insert into t1 values (0xEE00);
|
||||
select * into outfile 'test/t1.txt' from t1;
|
||||
delete from t1;
|
||||
select hex(load_file('test/t1.txt'));
|
||||
hex(load_file('test/t1.txt'))
|
||||
select hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'));;
|
||||
hex(load_file('MYSQLTEST_VARDIR/master-data/test/t1.txt'))
|
||||
5CEE5C300A
|
||||
load data infile 't1.txt' into table t1;
|
||||
select hex(a) from t1;
|
||||
|
@ -603,3 +603,11 @@ check table t1 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a varchar(2) character set latin7 collate latin7_general_ci,key(a));
|
||||
insert into t1 set a=0x4c20;
|
||||
insert into t1 set a=0x6c;
|
||||
insert into t1 set a=0x4c98;
|
||||
check table t1 extended;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
|
@ -11335,6 +11335,22 @@ cp932_bin 6109
|
||||
cp932_bin 61
|
||||
cp932_bin 6120
|
||||
drop table t1;
|
||||
create table t2 (a char(1));
|
||||
insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
|
||||
insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
|
||||
create table t1 (
|
||||
a varchar(2) character set cp932
|
||||
) engine=myisam;
|
||||
insert into t1
|
||||
select unhex(concat(t24.a, t23.a, t22.a, t21.a))
|
||||
from t2 t21, t2 t22, t2 t23, t2 t24;
|
||||
delete from t1 where a='';
|
||||
alter table t1 add key(a);
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
create table t1 (col1 varchar(1)) character set cp932;
|
||||
insert into t1 values ('a');
|
||||
insert into t1 values ('ab');
|
||||
|
@ -391,3 +391,7 @@ ABC
|
||||
SELECT convert(@str collate latin1_swedish_ci using utf8);
|
||||
convert(@str collate latin1_swedish_ci using utf8)
|
||||
ABC €°§ß²³µ~ äöüÄÖÜ áéíóú ÀÈÌÒÙ @ abc
|
||||
select hex(cast(_ascii 0x7f as char(1) character set latin1));
|
||||
hex(cast(_ascii 0x7f as char(1) character set latin1))
|
||||
7F
|
||||
End of 5.0 tests
|
||||
|
@ -886,4 +886,14 @@ collation(group_concat(a separator ','))
|
||||
latin1_swedish_ci
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
create table t1 (s1 char(1) character set ascii, s2 char(1) character set ucs2);
|
||||
insert into t1 (s1) values (0x7f);
|
||||
update t1 set s2 = s1;
|
||||
select hex(s2) from t1;
|
||||
hex(s2)
|
||||
007F
|
||||
select hex(convert(s1 using latin1)) from t1;
|
||||
hex(convert(s1 using latin1))
|
||||
7F
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -810,4 +810,13 @@ LENGTH( GROUP_CONCAT( a ) )
|
||||
65535
|
||||
SET group_concat_max_len= DEFAULT;
|
||||
DROP TABLE t1, t2, t3;
|
||||
set names latin1;
|
||||
create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8;
|
||||
insert into t1 (id, name) values (1, "óra");
|
||||
insert into t1 (id, name) values (2, "óra");
|
||||
select b.id, group_concat(b.name) from t1 a, t1 b group by b.id;
|
||||
id group_concat(b.name)
|
||||
1 óra,óra
|
||||
2 óra,óra
|
||||
drop table t1;
|
||||
End of 5.0 tests
|
||||
|
@ -1444,3 +1444,16 @@ OPTIMIZE TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 optimize status OK
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b));
|
||||
INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
|
||||
INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
|
||||
SELECT COUNT(*) FROM t1 WHERE
|
||||
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
|
||||
COUNT(*)
|
||||
2
|
||||
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
|
||||
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
|
||||
COUNT(*)
|
||||
2
|
||||
DROP TABLE t1;
|
||||
End of 5.0 tests.
|
||||
|
@ -455,3 +455,64 @@ a
|
||||
1
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, t2;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`filler` char(200) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
KEY `a` (`a`),
|
||||
KEY `b` (`b`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
insert into t1 values
|
||||
(0, 'filler', 0), (1, 'filler', 1), (2, 'filler', 2), (3, 'filler', 3),
|
||||
(4, 'filler', 4), (5, 'filler', 5), (6, 'filler', 6), (7, 'filler', 7),
|
||||
(8, 'filler', 8), (9, 'filler', 9), (0, 'filler', 0), (1, 'filler', 1),
|
||||
(2, 'filler', 2), (3, 'filler', 3), (4, 'filler', 4), (5, 'filler', 5),
|
||||
(6, 'filler', 6), (7, 'filler', 7), (8, 'filler', 8), (9, 'filler', 9),
|
||||
(10, 'filler', 10), (11, 'filler', 11), (12, 'filler', 12), (13, 'filler', 13),
|
||||
(14, 'filler', 14), (15, 'filler', 15), (16, 'filler', 16), (17, 'filler', 17),
|
||||
(18, 'filler', 18), (19, 'filler', 19), (4, '5 ', 0), (5, '4 ', 0),
|
||||
(4, '4 ', 0), (4, 'qq ', 5), (5, 'qq ', 4), (4, 'zz ', 4);
|
||||
create table t2(
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`filler` char(200) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
KEY USING BTREE (`a`),
|
||||
KEY USING BTREE (`b`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
insert into t2 select * from t1;
|
||||
must use sort-union rather than union:
|
||||
explain select * from t1 where a=4 or b=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index_merge a,b a,b 5,5 NULL # Using sort_union(a,b); Using where
|
||||
select * from t1 where a=4 or b=4;
|
||||
a filler b
|
||||
4 4 0
|
||||
4 5 0
|
||||
4 filler 4
|
||||
4 filler 4
|
||||
4 qq 5
|
||||
4 zz 4
|
||||
5 qq 4
|
||||
select * from t1 ignore index(a,b) where a=4 or b=4;
|
||||
a filler b
|
||||
4 4 0
|
||||
4 5 0
|
||||
4 filler 4
|
||||
4 filler 4
|
||||
4 qq 5
|
||||
4 zz 4
|
||||
5 qq 4
|
||||
must use union, not sort-union:
|
||||
explain select * from t2 where a=4 or b=4;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index_merge a,b a,b 5,5 NULL # Using union(a,b); Using where
|
||||
select * from t2 where a=4 or b=4;
|
||||
a filler b
|
||||
4 4 0
|
||||
4 5 0
|
||||
4 filler 4
|
||||
4 filler 4
|
||||
4 qq 5
|
||||
4 zz 4
|
||||
5 qq 4
|
||||
drop table t1, t2;
|
||||
|
@ -1632,4 +1632,115 @@ INSERT INTO t3 VALUES (1,1);
|
||||
SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
|
||||
ERROR 23000: Column 'a' in from clause is ambiguous
|
||||
DROP TABLE t1,t2,t3;
|
||||
CREATE TABLE t1 (
|
||||
carrier char(2) default NULL,
|
||||
id int NOT NULL auto_increment PRIMARY KEY
|
||||
);
|
||||
INSERT INTO t1 VALUES
|
||||
('CO',235371754),('CO',235376554),('CO',235376884),('CO',235377874),
|
||||
('CO',231060394),('CO',231059224),('CO',231059314),('CO',231060484),
|
||||
('CO',231060274),('CO',231060124),('CO',231060244),('CO',231058594),
|
||||
('CO',231058924),('CO',231058504),('CO',231059344),('CO',231060424),
|
||||
('CO',231059554),('CO',231060304),('CO',231059644),('CO',231059464),
|
||||
('CO',231059764),('CO',231058294),('CO',231058624),('CO',231058864),
|
||||
('CO',231059374),('CO',231059584),('CO',231059734),('CO',231059014),
|
||||
('CO',231059854),('CO',231059494),('CO',231059794),('CO',231058534),
|
||||
('CO',231058324),('CO',231058684),('CO',231059524),('CO',231059974);
|
||||
CREATE TABLE t2 (
|
||||
scan_date date default NULL,
|
||||
package_id int default NULL,
|
||||
INDEX scan_date(scan_date),
|
||||
INDEX package_id(package_id)
|
||||
);
|
||||
INSERT INTO t2 VALUES
|
||||
('2008-12-29',231062944),('2008-12-29',231065764),('2008-12-29',231066124),
|
||||
('2008-12-29',231060094),('2008-12-29',231061054),('2008-12-29',231065644),
|
||||
('2008-12-29',231064384),('2008-12-29',231064444),('2008-12-29',231073774),
|
||||
('2008-12-29',231058594),('2008-12-29',231059374),('2008-12-29',231066004),
|
||||
('2008-12-29',231068494),('2008-12-29',231070174),('2008-12-29',231071884),
|
||||
('2008-12-29',231063274),('2008-12-29',231063754),('2008-12-29',231064144),
|
||||
('2008-12-29',231069424),('2008-12-29',231073714),('2008-12-29',231058414),
|
||||
('2008-12-29',231060994),('2008-12-29',231069154),('2008-12-29',231068614),
|
||||
('2008-12-29',231071464),('2008-12-29',231074014),('2008-12-29',231059614),
|
||||
('2008-12-29',231059074),('2008-12-29',231059464),('2008-12-29',231069094),
|
||||
('2008-12-29',231067294),('2008-12-29',231070144),('2008-12-29',231073804),
|
||||
('2008-12-29',231072634),('2008-12-29',231058294),('2008-12-29',231065344),
|
||||
('2008-12-29',231066094),('2008-12-29',231069034),('2008-12-29',231058594),
|
||||
('2008-12-29',231059854),('2008-12-29',231059884),('2008-12-29',231059914),
|
||||
('2008-12-29',231063664),('2008-12-29',231063814),('2008-12-29',231063904);
|
||||
CREATE TABLE t3 (
|
||||
package_id int default NULL,
|
||||
INDEX package_id(package_id)
|
||||
);
|
||||
INSERT INTO t3 VALUES
|
||||
(231058294),(231058324),(231058354),(231058384),(231058414),(231058444),
|
||||
(231058474),(231058504),(231058534),(231058564),(231058594),(231058624),
|
||||
(231058684),(231058744),(231058804),(231058864),(231058924),(231058954),
|
||||
(231059014),(231059074),(231059104),(231059134),(231059164),(231059194),
|
||||
(231059224),(231059254),(231059284),(231059314),(231059344),(231059374),
|
||||
(231059404),(231059434),(231059464),(231059494),(231059524),(231059554),
|
||||
(231059584),(231059614),(231059644),(231059674),(231059704),(231059734),
|
||||
(231059764),(231059794),(231059824),(231059854),(231059884),(231059914),
|
||||
(231059944),(231059974),(231060004),(231060034),(231060064),(231060094),
|
||||
(231060124),(231060154),(231060184),(231060214),(231060244),(231060274),
|
||||
(231060304),(231060334),(231060364),(231060394),(231060424),(231060454),
|
||||
(231060484),(231060514),(231060544),(231060574),(231060604),(231060634),
|
||||
(231060664),(231060694),(231060724),(231060754),(231060784),(231060814),
|
||||
(231060844),(231060874),(231060904),(231060934),(231060964),(231060994),
|
||||
(231061024),(231061054),(231061084),(231061144),(231061174),(231061204),
|
||||
(231061234),(231061294),(231061354),(231061384),(231061414),(231061474),
|
||||
(231061564),(231061594),(231061624),(231061684),(231061714),(231061774),
|
||||
(231061804),(231061894),(231061984),(231062074),(231062134),(231062224),
|
||||
(231062254),(231062314),(231062374),(231062434),(231062494),(231062554),
|
||||
(231062584),(231062614),(231062644),(231062704),(231062734),(231062794),
|
||||
(231062854),(231062884),(231062944),(231063004),(231063034),(231063064),
|
||||
(231063124),(231063154),(231063184),(231063214),(231063274),(231063334),
|
||||
(231063394),(231063424),(231063454),(231063514),(231063574),(231063664);
|
||||
CREATE TABLE t4 (
|
||||
carrier char(2) NOT NULL default '' PRIMARY KEY,
|
||||
id int(11) default NULL,
|
||||
INDEX id(id)
|
||||
);
|
||||
INSERT INTO t4 VALUES
|
||||
('99',6),('SK',456),('UA',486),('AI',1081),('OS',1111),('VS',1510);
|
||||
CREATE TABLE t5 (
|
||||
carrier_id int default NULL,
|
||||
INDEX carrier_id(carrier_id)
|
||||
);
|
||||
INSERT INTO t5 VALUES
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(456),(456),(456),
|
||||
(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),
|
||||
(456),(486),(1081),(1111),(1111),(1111),(1111),(1510);
|
||||
SELECT COUNT(*)
|
||||
FROM((t2 JOIN t1 ON t2.package_id = t1.id)
|
||||
JOIN t3 ON t3.package_id = t1.id);
|
||||
COUNT(*)
|
||||
6
|
||||
EXPLAIN
|
||||
SELECT COUNT(*)
|
||||
FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
|
||||
JOIN t3 ON t3.package_id = t1.id)
|
||||
LEFT JOIN
|
||||
(t5 JOIN t4 ON t5.carrier_id = t4.id)
|
||||
ON t4.carrier = t1.carrier;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index package_id package_id 5 NULL 45 Using index
|
||||
1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.package_id 1
|
||||
1 SIMPLE t4 eq_ref PRIMARY,id PRIMARY 2 test.t1.carrier 1
|
||||
1 SIMPLE t5 ref carrier_id carrier_id 5 test.t4.id 22 Using index
|
||||
1 SIMPLE t3 ref package_id package_id 5 test.t1.id 1 Using where; Using index
|
||||
SELECT COUNT(*)
|
||||
FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
|
||||
JOIN t3 ON t3.package_id = t1.id)
|
||||
LEFT JOIN
|
||||
(t5 JOIN t4 ON t5.carrier_id = t4.id)
|
||||
ON t4.carrier = t1.carrier;
|
||||
COUNT(*)
|
||||
6
|
||||
DROP TABLE t1,t2,t3,t4,t5;
|
||||
End of 5.0 tests
|
||||
|
@ -1889,7 +1889,7 @@ DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
@ -1968,7 +1968,7 @@ DROP TABLE IF EXISTS `v1`;
|
||||
/*!50001 CREATE TABLE `v1` (
|
||||
`a` int(11)
|
||||
) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
@ -2027,7 +2027,7 @@ DROP TABLE IF EXISTS `v2`;
|
||||
/*!50001 CREATE TABLE `v2` (
|
||||
`a` varchar(30)
|
||||
) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
@ -2137,17 +2137,17 @@ DROP TABLE IF EXISTS `v3`;
|
||||
`b` int(11),
|
||||
`c` varchar(30)
|
||||
) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v1` AS select `v3`.`a` AS `a`,`v3`.`b` AS `b`,`v3`.`c` AS `c` from `v3` where (`v3`.`b` in (1,2,3,4,5,6,7)) */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v2` AS select `v3`.`a` AS `a` from (`v3` join `v1`) where ((`v1`.`a` = `v3`.`a`) and (`v3`.`b` = 3)) limit 1 */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v3`*/;
|
||||
/*!50001 DROP TABLE `v3`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v3`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
@ -2721,17 +2721,17 @@ DROP TABLE IF EXISTS `v2`;
|
||||
) */;
|
||||
|
||||
USE `test`;
|
||||
/*!50001 DROP TABLE IF EXISTS `v0`*/;
|
||||
/*!50001 DROP TABLE `v0`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v0`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v0` AS select `v1`.`a` AS `a`,`v1`.`b` AS `b`,`v1`.`c` AS `c` from `v1` */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v1` AS select `t1`.`a` AS `a`,`t1`.`b` AS `b`,`t1`.`c` AS `c` from `t1` */;
|
||||
/*!50001 DROP TABLE IF EXISTS `v2`*/;
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v2`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
@ -2941,11 +2941,13 @@ insert into t values(5, 51);
|
||||
create view v1 as select qty, price, qty*price as value from t;
|
||||
create view v2 as select qty from v1;
|
||||
mysqldump {
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v1` AS select `t`.`qty` AS `qty`,`t`.`price` AS `price`,(`t`.`qty` * `t`.`price`) AS `value` from `t` */;
|
||||
|
||||
} mysqldump {
|
||||
/*!50001 DROP TABLE `v2`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `v2` AS select `v1`.`qty` AS `qty` from `v1` */;
|
||||
@ -3029,7 +3031,7 @@ DROP TABLE IF EXISTS `v1`;
|
||||
) */;
|
||||
|
||||
USE `mysqldump_test_db`;
|
||||
/*!50001 DROP TABLE IF EXISTS `v1`*/;
|
||||
/*!50001 DROP TABLE `v1`*/;
|
||||
/*!50001 DROP VIEW IF EXISTS `v1`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
@ -3076,6 +3078,7 @@ USE `mysqldump_views`;
|
||||
USE `mysqldump_tables`;
|
||||
|
||||
USE `mysqldump_views`;
|
||||
/*!50001 DROP TABLE `nasishnasifu`*/;
|
||||
/*!50001 CREATE ALGORITHM=UNDEFINED */
|
||||
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
|
||||
/*!50001 VIEW `mysqldump_views`.`nasishnasifu` AS select `mysqldump_tables`.`basetable`.`id` AS `id` from `mysqldump_tables`.`basetable` */;
|
||||
@ -3321,5 +3324,15 @@ CREATE TABLE `t1` (
|
||||
INSERT INTO `t1` VALUES (11,0x7171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171717171);
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# Bug #28524: mysqldump --skip-add-drop-table is not
|
||||
# compatible with views
|
||||
#
|
||||
CREATE VIEW v1 AS SELECT 1;
|
||||
DROP VIEW v1;
|
||||
SELECT * FROM v1;
|
||||
1
|
||||
1
|
||||
DROP VIEW v1;
|
||||
#
|
||||
# End of 5.0 tests
|
||||
#
|
||||
|
@ -133,4 +133,26 @@ a
|
||||
42
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
USE db2;
|
||||
INSERT INTO db2.t1 VALUES (1);
|
||||
SELECT * FROM db2.t1;
|
||||
b
|
||||
1
|
||||
RESET QUERY CACHE;
|
||||
USE db1;
|
||||
SET SESSION keep_files_on_create = TRUE;
|
||||
CREATE TABLE t1 (a INT) ENGINE MYISAM;
|
||||
ERROR HY000: Can't create/write to file './db1/t1.MYD' (Errcode: 17)
|
||||
CREATE TABLE t3 (a INT) Engine=MyISAM;
|
||||
INSERT INTO t3 VALUES (1),(2),(3);
|
||||
TRUNCATE TABLE t3;
|
||||
SELECT * from t3;
|
||||
a
|
||||
SET SESSION keep_files_on_create = DEFAULT;
|
||||
DROP TABLE db2.t1, db1.t3;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
USE test;
|
||||
End of 5.0 tests
|
||||
|
@ -1809,3 +1809,23 @@ f1
|
||||
|
||||
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (c1 ENUM('a', '', 'b'));
|
||||
INSERT INTO t1 (c1) VALUES ('b');
|
||||
INSERT INTO t1 (c1) VALUES ('');
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'c1' at row 1
|
||||
INSERT INTO t1 (c1) VALUES ('');
|
||||
SELECT c1 + 0, COUNT(c1) FROM t1 GROUP BY c1;
|
||||
c1 + 0 COUNT(c1)
|
||||
0 1
|
||||
2 2
|
||||
3 1
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
SELECT c1 + 0 FROM t2;
|
||||
c1 + 0
|
||||
3
|
||||
2
|
||||
0
|
||||
2
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -208,10 +208,6 @@ options flags
|
||||
one one
|
||||
drop table t2;
|
||||
create table t2 select * from t1;
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'options' at row 4
|
||||
Warning 1265 Data truncated for column 'options' at row 5
|
||||
Warning 1265 Data truncated for column 'options' at row 6
|
||||
update t2 set string="changed" where auto=16;
|
||||
show full columns from t1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
|
@ -85,3 +85,46 @@ sec_to_time(time_to_sec(t))
|
||||
13:00:00
|
||||
09:00:00
|
||||
drop table t1;
|
||||
select cast('100:55:50' as time) < cast('24:00:00' as time);
|
||||
cast('100:55:50' as time) < cast('24:00:00' as time)
|
||||
0
|
||||
select cast('100:55:50' as time) < cast('024:00:00' as time);
|
||||
cast('100:55:50' as time) < cast('024:00:00' as time)
|
||||
0
|
||||
select cast('300:55:50' as time) < cast('240:00:00' as time);
|
||||
cast('300:55:50' as time) < cast('240:00:00' as time)
|
||||
0
|
||||
select cast('100:55:50' as time) > cast('24:00:00' as time);
|
||||
cast('100:55:50' as time) > cast('24:00:00' as time)
|
||||
1
|
||||
select cast('100:55:50' as time) > cast('024:00:00' as time);
|
||||
cast('100:55:50' as time) > cast('024:00:00' as time)
|
||||
1
|
||||
select cast('300:55:50' as time) > cast('240:00:00' as time);
|
||||
cast('300:55:50' as time) > cast('240:00:00' as time)
|
||||
1
|
||||
create table t1 (f1 time);
|
||||
insert into t1 values ('24:00:00');
|
||||
select cast('24:00:00' as time) = (select f1 from t1);
|
||||
cast('24:00:00' as time) = (select f1 from t1)
|
||||
1
|
||||
drop table t1;
|
||||
create table t1(f1 time, f2 time);
|
||||
insert into t1 values('20:00:00','150:00:00');
|
||||
select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
f2 date NOT NULL,
|
||||
f3 int(11) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (f3, f2)
|
||||
);
|
||||
insert into t1 values('2007-07-01', 1);
|
||||
insert into t1 values('2007-07-01', 2);
|
||||
insert into t1 values('2007-07-02', 1);
|
||||
insert into t1 values('2007-07-02', 2);
|
||||
SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
|
||||
sum(f3)
|
||||
3
|
||||
drop table t1;
|
||||
|
@ -237,4 +237,13 @@ select hex(cast('a' as char(2) binary));
|
||||
select hex(cast('a' as binary(2)));
|
||||
select hex(cast('a' as char(2) binary));
|
||||
|
||||
#
|
||||
# Bug#29898: Item_date_typecast::val_int doesn't reset the null_value flag.
|
||||
#
|
||||
CREATE TABLE t1 (d1 datetime);
|
||||
INSERT INTO t1(d1) VALUES ('2007-07-19 08:30:00'), (NULL),
|
||||
('2007-07-19 08:34:00'), (NULL), ('2007-07-19 08:36:00');
|
||||
SELECT cast(date(d1) as signed) FROM t1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -17,4 +17,5 @@ primary key (_id)
|
||||
show create table `about:text`;
|
||||
drop table `about:text`;
|
||||
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -68,15 +68,16 @@ select hex(convert(_big5 0xC84041 using ucs2));
|
||||
#
|
||||
# Bug#26711 "binary content 0x00 sometimes becomes 0x5C 0x00 after dump/load"
|
||||
#
|
||||
set names big5;
|
||||
create table t1 (a blob);
|
||||
insert into t1 values (0xEE00);
|
||||
--exec $MYSQL_DUMP --default-character-set=big5 -T $MYSQLTEST_VARDIR/master-data/test test t1
|
||||
select * into outfile 'test/t1.txt' from t1;
|
||||
delete from t1;
|
||||
select hex(load_file('test/t1.txt'));
|
||||
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--eval select hex(load_file('$MYSQLTEST_VARDIR/master-data/test/t1.txt'));
|
||||
load data infile 't1.txt' into table t1;
|
||||
select hex(a) from t1;
|
||||
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.txt
|
||||
--exec rm $MYSQLTEST_VARDIR/master-data/test/t1.sql
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -218,3 +218,14 @@ insert into t1 set f1=0x3F3F1E563F;
|
||||
insert into t1 set f1=0x3F3F;
|
||||
check table t1 extended;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#29461: Sort order of the collation wasn't used when comparing characters
|
||||
# with the space character.
|
||||
#
|
||||
create table t1 (a varchar(2) character set latin7 collate latin7_general_ci,key(a));
|
||||
insert into t1 set a=0x4c20;
|
||||
insert into t1 set a=0x6c;
|
||||
insert into t1 set a=0x4c98;
|
||||
check table t1 extended;
|
||||
drop table t1;
|
||||
|
@ -403,6 +403,28 @@ SET collation_connection='cp932_japanese_ci';
|
||||
SET collation_connection='cp932_bin';
|
||||
-- source include/ctype_filesort.inc
|
||||
|
||||
#
|
||||
# Bug#29333 myisam corruption with
|
||||
# character set cp932 collate cp932_japanese_ci
|
||||
#
|
||||
create table t2 (a char(1));
|
||||
insert into t2 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7');
|
||||
insert into t2 values ('8'),('9'),('A'),('B'),('C'),('D'),('E'),('F');
|
||||
create table t1 (
|
||||
a varchar(2) character set cp932
|
||||
) engine=myisam;
|
||||
--disable_warnings
|
||||
insert into t1
|
||||
select unhex(concat(t24.a, t23.a, t22.a, t21.a))
|
||||
from t2 t21, t2 t22, t2 t23, t2 t24;
|
||||
--enable_warnings
|
||||
delete from t1 where a='';
|
||||
alter table t1 add key(a);
|
||||
check table t1;
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
|
||||
|
||||
#
|
||||
# Bug#12547: Inserting long string into varchar causes table crash in cp932
|
||||
#
|
||||
|
@ -110,3 +110,10 @@ SELECT convert(@str collate latin1_german2_ci using utf8);
|
||||
SELECT convert(@str collate latin1_swedish_ci using utf8);
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#29499 Converting 'del' from ascii to Unicode results in 'question mark'
|
||||
#
|
||||
select hex(cast(_ascii 0x7f as char(1) character set latin1));
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -612,4 +612,14 @@ select collation(group_concat(a separator ',')) from t1;
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# Bug#29499 Converting 'del' from ascii to Unicode results in 'question mark'
|
||||
#
|
||||
create table t1 (s1 char(1) character set ascii, s2 char(1) character set ucs2);
|
||||
insert into t1 (s1) values (0x7f);
|
||||
update t1 set s2 = s1;
|
||||
select hex(s2) from t1;
|
||||
select hex(convert(s1 using latin1)) from t1;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -551,4 +551,15 @@ SELECT LENGTH( GROUP_CONCAT( a ) ) FROM t3 WHERE b = 3;
|
||||
SET group_concat_max_len= DEFAULT;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
||||
#
|
||||
# Bug#29850: Wrong charset of the GROUP_CONCAT result when the select employs
|
||||
# a temporary table.
|
||||
#
|
||||
set names latin1;
|
||||
create table t1 (id int, name varchar(20)) DEFAULT CHARSET=utf8;
|
||||
insert into t1 (id, name) values (1, "óra");
|
||||
insert into t1 (id, name) values (2, "óra");
|
||||
select b.id, group_concat(b.name) from t1 a, t1 b group by b.id;
|
||||
drop table t1;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -827,3 +827,22 @@ INSERT INTO t1 (b) SELECT b FROM t1;
|
||||
|
||||
OPTIMIZE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Bug #29070: Error in spatial index
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a INT, b GEOMETRY NOT NULL, SPATIAL KEY b(b));
|
||||
INSERT INTO t1 VALUES (1, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
|
||||
INSERT INTO t1 VALUES (2, GEOMFROMTEXT('LINESTRING(1102218.456 1,2000000 2)'));
|
||||
|
||||
# must return the same number as the next select
|
||||
SELECT COUNT(*) FROM t1 WHERE
|
||||
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
|
||||
SELECT COUNT(*) FROM t1 IGNORE INDEX (b) WHERE
|
||||
MBRINTERSECTS(b, GEOMFROMTEXT('LINESTRING(1 1,1102219 2)') );
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo End of 5.0 tests.
|
||||
|
@ -415,3 +415,51 @@ INSERT INTO t2(a,b) VALUES(1,2);
|
||||
SELECT t2.a FROM t1,t2 WHERE t2.b=2 AND t2.a=1;
|
||||
UNLOCK TABLES;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
#
|
||||
# BUG#29740: HA_KEY_SCAN_NOT_ROR wasn't set for HEAP engine
|
||||
#
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`filler` char(200) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
KEY `a` (`a`),
|
||||
KEY `b` (`b`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
|
||||
insert into t1 values
|
||||
(0, 'filler', 0), (1, 'filler', 1), (2, 'filler', 2), (3, 'filler', 3),
|
||||
(4, 'filler', 4), (5, 'filler', 5), (6, 'filler', 6), (7, 'filler', 7),
|
||||
(8, 'filler', 8), (9, 'filler', 9), (0, 'filler', 0), (1, 'filler', 1),
|
||||
(2, 'filler', 2), (3, 'filler', 3), (4, 'filler', 4), (5, 'filler', 5),
|
||||
(6, 'filler', 6), (7, 'filler', 7), (8, 'filler', 8), (9, 'filler', 9),
|
||||
(10, 'filler', 10), (11, 'filler', 11), (12, 'filler', 12), (13, 'filler', 13),
|
||||
(14, 'filler', 14), (15, 'filler', 15), (16, 'filler', 16), (17, 'filler', 17),
|
||||
(18, 'filler', 18), (19, 'filler', 19), (4, '5 ', 0), (5, '4 ', 0),
|
||||
(4, '4 ', 0), (4, 'qq ', 5), (5, 'qq ', 4), (4, 'zz ', 4);
|
||||
|
||||
create table t2(
|
||||
`a` int(11) DEFAULT NULL,
|
||||
`filler` char(200) DEFAULT NULL,
|
||||
`b` int(11) DEFAULT NULL,
|
||||
KEY USING BTREE (`a`),
|
||||
KEY USING BTREE (`b`)
|
||||
) ENGINE=MEMORY DEFAULT CHARSET=latin1;
|
||||
insert into t2 select * from t1;
|
||||
|
||||
--echo must use sort-union rather than union:
|
||||
--replace_column 9 #
|
||||
explain select * from t1 where a=4 or b=4;
|
||||
--sorted_result
|
||||
select * from t1 where a=4 or b=4;
|
||||
--sorted_result
|
||||
select * from t1 ignore index(a,b) where a=4 or b=4;
|
||||
|
||||
--echo must use union, not sort-union:
|
||||
--replace_column 9 #
|
||||
explain select * from t2 where a=4 or b=4;
|
||||
--sorted_result
|
||||
select * from t2 where a=4 or b=4;
|
||||
|
||||
drop table t1, t2;
|
||||
|
||||
|
@ -1083,4 +1083,118 @@ SELECT * FROM t1 JOIN (t2 JOIN t3 USING (b)) USING (a);
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
#
|
||||
# BUG#29604: inner nest of left join interleaves with outer tables
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (
|
||||
carrier char(2) default NULL,
|
||||
id int NOT NULL auto_increment PRIMARY KEY
|
||||
);
|
||||
INSERT INTO t1 VALUES
|
||||
('CO',235371754),('CO',235376554),('CO',235376884),('CO',235377874),
|
||||
('CO',231060394),('CO',231059224),('CO',231059314),('CO',231060484),
|
||||
('CO',231060274),('CO',231060124),('CO',231060244),('CO',231058594),
|
||||
('CO',231058924),('CO',231058504),('CO',231059344),('CO',231060424),
|
||||
('CO',231059554),('CO',231060304),('CO',231059644),('CO',231059464),
|
||||
('CO',231059764),('CO',231058294),('CO',231058624),('CO',231058864),
|
||||
('CO',231059374),('CO',231059584),('CO',231059734),('CO',231059014),
|
||||
('CO',231059854),('CO',231059494),('CO',231059794),('CO',231058534),
|
||||
('CO',231058324),('CO',231058684),('CO',231059524),('CO',231059974);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
scan_date date default NULL,
|
||||
package_id int default NULL,
|
||||
INDEX scan_date(scan_date),
|
||||
INDEX package_id(package_id)
|
||||
);
|
||||
INSERT INTO t2 VALUES
|
||||
('2008-12-29',231062944),('2008-12-29',231065764),('2008-12-29',231066124),
|
||||
('2008-12-29',231060094),('2008-12-29',231061054),('2008-12-29',231065644),
|
||||
('2008-12-29',231064384),('2008-12-29',231064444),('2008-12-29',231073774),
|
||||
('2008-12-29',231058594),('2008-12-29',231059374),('2008-12-29',231066004),
|
||||
('2008-12-29',231068494),('2008-12-29',231070174),('2008-12-29',231071884),
|
||||
('2008-12-29',231063274),('2008-12-29',231063754),('2008-12-29',231064144),
|
||||
('2008-12-29',231069424),('2008-12-29',231073714),('2008-12-29',231058414),
|
||||
('2008-12-29',231060994),('2008-12-29',231069154),('2008-12-29',231068614),
|
||||
('2008-12-29',231071464),('2008-12-29',231074014),('2008-12-29',231059614),
|
||||
('2008-12-29',231059074),('2008-12-29',231059464),('2008-12-29',231069094),
|
||||
('2008-12-29',231067294),('2008-12-29',231070144),('2008-12-29',231073804),
|
||||
('2008-12-29',231072634),('2008-12-29',231058294),('2008-12-29',231065344),
|
||||
('2008-12-29',231066094),('2008-12-29',231069034),('2008-12-29',231058594),
|
||||
('2008-12-29',231059854),('2008-12-29',231059884),('2008-12-29',231059914),
|
||||
('2008-12-29',231063664),('2008-12-29',231063814),('2008-12-29',231063904);
|
||||
|
||||
CREATE TABLE t3 (
|
||||
package_id int default NULL,
|
||||
INDEX package_id(package_id)
|
||||
);
|
||||
INSERT INTO t3 VALUES
|
||||
(231058294),(231058324),(231058354),(231058384),(231058414),(231058444),
|
||||
(231058474),(231058504),(231058534),(231058564),(231058594),(231058624),
|
||||
(231058684),(231058744),(231058804),(231058864),(231058924),(231058954),
|
||||
(231059014),(231059074),(231059104),(231059134),(231059164),(231059194),
|
||||
(231059224),(231059254),(231059284),(231059314),(231059344),(231059374),
|
||||
(231059404),(231059434),(231059464),(231059494),(231059524),(231059554),
|
||||
(231059584),(231059614),(231059644),(231059674),(231059704),(231059734),
|
||||
(231059764),(231059794),(231059824),(231059854),(231059884),(231059914),
|
||||
(231059944),(231059974),(231060004),(231060034),(231060064),(231060094),
|
||||
(231060124),(231060154),(231060184),(231060214),(231060244),(231060274),
|
||||
(231060304),(231060334),(231060364),(231060394),(231060424),(231060454),
|
||||
(231060484),(231060514),(231060544),(231060574),(231060604),(231060634),
|
||||
(231060664),(231060694),(231060724),(231060754),(231060784),(231060814),
|
||||
(231060844),(231060874),(231060904),(231060934),(231060964),(231060994),
|
||||
(231061024),(231061054),(231061084),(231061144),(231061174),(231061204),
|
||||
(231061234),(231061294),(231061354),(231061384),(231061414),(231061474),
|
||||
(231061564),(231061594),(231061624),(231061684),(231061714),(231061774),
|
||||
(231061804),(231061894),(231061984),(231062074),(231062134),(231062224),
|
||||
(231062254),(231062314),(231062374),(231062434),(231062494),(231062554),
|
||||
(231062584),(231062614),(231062644),(231062704),(231062734),(231062794),
|
||||
(231062854),(231062884),(231062944),(231063004),(231063034),(231063064),
|
||||
(231063124),(231063154),(231063184),(231063214),(231063274),(231063334),
|
||||
(231063394),(231063424),(231063454),(231063514),(231063574),(231063664);
|
||||
|
||||
CREATE TABLE t4 (
|
||||
carrier char(2) NOT NULL default '' PRIMARY KEY,
|
||||
id int(11) default NULL,
|
||||
INDEX id(id)
|
||||
);
|
||||
INSERT INTO t4 VALUES
|
||||
('99',6),('SK',456),('UA',486),('AI',1081),('OS',1111),('VS',1510);
|
||||
|
||||
CREATE TABLE t5 (
|
||||
carrier_id int default NULL,
|
||||
INDEX carrier_id(carrier_id)
|
||||
);
|
||||
INSERT INTO t5 VALUES
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),
|
||||
(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(6),(456),(456),(456),
|
||||
(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),(456),
|
||||
(456),(486),(1081),(1111),(1111),(1111),(1111),(1510);
|
||||
|
||||
SELECT COUNT(*)
|
||||
FROM((t2 JOIN t1 ON t2.package_id = t1.id)
|
||||
JOIN t3 ON t3.package_id = t1.id);
|
||||
|
||||
EXPLAIN
|
||||
SELECT COUNT(*)
|
||||
FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
|
||||
JOIN t3 ON t3.package_id = t1.id)
|
||||
LEFT JOIN
|
||||
(t5 JOIN t4 ON t5.carrier_id = t4.id)
|
||||
ON t4.carrier = t1.carrier;
|
||||
SELECT COUNT(*)
|
||||
FROM ((t2 JOIN t1 ON t2.package_id = t1.id)
|
||||
JOIN t3 ON t3.package_id = t1.id)
|
||||
LEFT JOIN
|
||||
(t5 JOIN t4 ON t5.carrier_id = t4.id)
|
||||
ON t4.carrier = t1.carrier;
|
||||
|
||||
DROP TABLE t1,t2,t3,t4,t5;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
||||
|
@ -1541,6 +1541,19 @@ INSERT INTO t1 SET c1=11, c2=REPEAT('q',509);
|
||||
--exec $MYSQL_DUMP --skip-create --compact --hex-blob test t1
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # Bug #28524: mysqldump --skip-add-drop-table is not
|
||||
--echo # compatible with views
|
||||
--echo #
|
||||
|
||||
CREATE VIEW v1 AS SELECT 1;
|
||||
--exec $MYSQL_DUMP --skip-add-drop-table test > $MYSQLTEST_VARDIR/tmp/bug28524.sql
|
||||
DROP VIEW v1;
|
||||
|
||||
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/bug28524.sql
|
||||
SELECT * FROM v1;
|
||||
DROP VIEW v1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 5.0 tests
|
||||
--echo #
|
||||
|
@ -178,4 +178,42 @@ drop table t1;
|
||||
|
||||
--echo End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #29325: create table overwrites .MYD file of other table (datadir)
|
||||
#
|
||||
|
||||
CREATE DATABASE db1;
|
||||
CREATE DATABASE db2;
|
||||
|
||||
USE db2;
|
||||
--disable_query_log
|
||||
eval CREATE TABLE t1 (b INT) ENGINE MYISAM
|
||||
DATA DIRECTORY = '$MYSQLTEST_VARDIR/master-data/db1/';
|
||||
--enable_query_log
|
||||
|
||||
INSERT INTO db2.t1 VALUES (1);
|
||||
SELECT * FROM db2.t1;
|
||||
RESET QUERY CACHE;
|
||||
|
||||
USE db1;
|
||||
|
||||
#no warning from create table
|
||||
SET SESSION keep_files_on_create = TRUE;
|
||||
--disable_abort_on_error
|
||||
CREATE TABLE t1 (a INT) ENGINE MYISAM;
|
||||
--enable_abort_on_error
|
||||
|
||||
CREATE TABLE t3 (a INT) Engine=MyISAM;
|
||||
INSERT INTO t3 VALUES (1),(2),(3);
|
||||
TRUNCATE TABLE t3;
|
||||
SELECT * from t3;
|
||||
|
||||
SET SESSION keep_files_on_create = DEFAULT;
|
||||
|
||||
DROP TABLE db2.t1, db1.t3;
|
||||
DROP DATABASE db1;
|
||||
DROP DATABASE db2;
|
||||
USE test;
|
||||
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -182,3 +182,21 @@ create table t1(f1 set('a','b'), index(f1));
|
||||
insert into t1 values(''),(''),('a'),('b');
|
||||
select * from t1 where f1='';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#29360: Confluence of the special 0 enum value with the normal empty string
|
||||
# value during field to field copy.
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (c1 ENUM('a', '', 'b'));
|
||||
INSERT INTO t1 (c1) VALUES ('b');
|
||||
INSERT INTO t1 (c1) VALUES ('');
|
||||
INSERT INTO t1 (c1) VALUES (0);
|
||||
INSERT INTO t1 (c1) VALUES ('');
|
||||
|
||||
SELECT c1 + 0, COUNT(c1) FROM t1 GROUP BY c1;
|
||||
|
||||
CREATE TABLE t2 SELECT * FROM t1;
|
||||
SELECT c1 + 0 FROM t2;
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -40,3 +40,40 @@ drop table t1;
|
||||
# ##########################################################
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug#29555: Comparing time values as strings may lead to a wrong result.
|
||||
#
|
||||
select cast('100:55:50' as time) < cast('24:00:00' as time);
|
||||
select cast('100:55:50' as time) < cast('024:00:00' as time);
|
||||
select cast('300:55:50' as time) < cast('240:00:00' as time);
|
||||
select cast('100:55:50' as time) > cast('24:00:00' as time);
|
||||
select cast('100:55:50' as time) > cast('024:00:00' as time);
|
||||
select cast('300:55:50' as time) > cast('240:00:00' as time);
|
||||
create table t1 (f1 time);
|
||||
insert into t1 values ('24:00:00');
|
||||
select cast('24:00:00' as time) = (select f1 from t1);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#29739: Incorrect time comparison in BETWEEN.
|
||||
#
|
||||
create table t1(f1 time, f2 time);
|
||||
insert into t1 values('20:00:00','150:00:00');
|
||||
select 1 from t1 where cast('100:00:00' as time) between f1 and f2;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#29729: Wrong conversion error led to an empty result set.
|
||||
#
|
||||
CREATE TABLE t1 (
|
||||
f2 date NOT NULL,
|
||||
f3 int(11) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (f3, f2)
|
||||
);
|
||||
insert into t1 values('2007-07-01', 1);
|
||||
insert into t1 values('2007-07-01', 2);
|
||||
insert into t1 values('2007-07-02', 1);
|
||||
insert into t1 values('2007-07-02', 2);
|
||||
SELECT sum(f3) FROM t1 where f2='2007-07-01 00:00:00' group by f2;
|
||||
drop table t1;
|
||||
|
@ -184,16 +184,19 @@ char* my_cgets(char *buffer, unsigned long clen, unsigned long* plen)
|
||||
}
|
||||
while (GetLastError() == ERROR_NOT_ENOUGH_MEMORY);
|
||||
|
||||
/* We go here on error reading the string (Ctrl-C for example) */
|
||||
if (!*plen)
|
||||
result= NULL; /* purecov: inspected */
|
||||
|
||||
if (result != NULL)
|
||||
{
|
||||
if (buffer[*plen - 2] == '\r')
|
||||
if (*plen > 1 && buffer[*plen - 2] == '\r')
|
||||
{
|
||||
*plen= *plen - 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer[*plen - 1] == '\r')
|
||||
if (*plen > 0 && buffer[*plen - 1] == '\r')
|
||||
{
|
||||
char tmp[3];
|
||||
int tmplen= sizeof(tmp);
|
||||
|
@ -52,11 +52,13 @@ File my_create_with_symlink(const char *linkname, const char *filename,
|
||||
{
|
||||
if (!access(filename,F_OK))
|
||||
{
|
||||
my_errno= errno= EEXIST;
|
||||
my_error(EE_CANTCREATEFILE, MYF(0), filename, EEXIST);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
if (create_link && !access(linkname,F_OK))
|
||||
{
|
||||
my_errno= errno= EEXIST;
|
||||
my_error(EE_CANTCREATEFILE, MYF(0), linkname, EEXIST);
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
@ -5271,7 +5271,8 @@ int Field_newdate::store(const char *from,uint len,CHARSET_INFO *cs)
|
||||
else
|
||||
{
|
||||
tmp= l_time.day + l_time.month*32 + l_time.year*16*32;
|
||||
if (!error && (ret != MYSQL_TIMESTAMP_DATE))
|
||||
if (!error && (ret != MYSQL_TIMESTAMP_DATE) &&
|
||||
thd->count_cuted_fields != CHECK_FIELD_IGNORE)
|
||||
error= 3; // Datetime was cut (note)
|
||||
}
|
||||
|
||||
|
@ -790,11 +790,18 @@ int field_conv(Field *to,Field *from)
|
||||
blob->value.copy();
|
||||
return blob->store(blob->value.ptr(),blob->value.length(),from->charset());
|
||||
}
|
||||
if ((from->result_type() == STRING_RESULT &&
|
||||
(to->result_type() == STRING_RESULT ||
|
||||
(from->real_type() != FIELD_TYPE_ENUM &&
|
||||
from->real_type() != FIELD_TYPE_SET))) ||
|
||||
to->type() == FIELD_TYPE_DECIMAL)
|
||||
if (from->real_type() == FIELD_TYPE_ENUM &&
|
||||
to->real_type() == FIELD_TYPE_ENUM &&
|
||||
from->val_int() == 0)
|
||||
{
|
||||
((Field_enum *)(to))->store_type(0);
|
||||
return 0;
|
||||
}
|
||||
else if ((from->result_type() == STRING_RESULT &&
|
||||
(to->result_type() == STRING_RESULT ||
|
||||
(from->real_type() != FIELD_TYPE_ENUM &&
|
||||
from->real_type() != FIELD_TYPE_SET))) ||
|
||||
to->type() == FIELD_TYPE_DECIMAL)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String result(buff,sizeof(buff),from->charset());
|
||||
|
@ -114,6 +114,26 @@ int ha_heap::close(void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Create a copy of this table
|
||||
|
||||
DESCRIPTION
|
||||
Do same as default implementation but use file->s->name instead of
|
||||
table->s->path. This is needed by Windows where the clone() call sees
|
||||
'/'-delimited path in table->s->path, while ha_peap::open() was called
|
||||
with '\'-delimited path.
|
||||
*/
|
||||
|
||||
handler *ha_heap::clone(MEM_ROOT *mem_root)
|
||||
{
|
||||
handler *new_handler= get_new_handler(table, mem_root, table->s->db_type);
|
||||
if (new_handler && !new_handler->ha_open(file->s->name, table->db_stat,
|
||||
HA_OPEN_IGNORE_IF_LOCKED))
|
||||
return new_handler;
|
||||
return NULL; /* purecov: inspected */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Compute which keys to use for scanning
|
||||
|
||||
|
@ -32,6 +32,7 @@ class ha_heap: public handler
|
||||
public:
|
||||
ha_heap(TABLE *table);
|
||||
~ha_heap() {}
|
||||
handler *clone(MEM_ROOT *mem_root);
|
||||
const char *table_type() const
|
||||
{
|
||||
return (table->in_use->variables.sql_mode & MODE_MYSQL323) ?
|
||||
@ -54,8 +55,8 @@ public:
|
||||
ulong index_flags(uint inx, uint part, bool all_parts) const
|
||||
{
|
||||
return ((table->key_info[inx].algorithm == HA_KEY_ALG_BTREE) ?
|
||||
HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
|
||||
HA_ONLY_WHOLE_INDEX);
|
||||
HA_READ_NEXT | HA_READ_PREV | HA_READ_ORDER | HA_READ_RANGE :
|
||||
HA_ONLY_WHOLE_INDEX | HA_KEY_SCAN_NOT_ROR);
|
||||
}
|
||||
const key_map *keys_to_use_for_scanning() { return &btree_keys; }
|
||||
uint max_supported_keys() const { return MAX_KEY; }
|
||||
@ -101,9 +102,7 @@ public:
|
||||
enum thr_lock_type lock_type);
|
||||
int cmp_ref(const byte *ref1, const byte *ref2)
|
||||
{
|
||||
HEAP_PTR ptr1=*(HEAP_PTR*)ref1;
|
||||
HEAP_PTR ptr2=*(HEAP_PTR*)ref2;
|
||||
return ptr1 < ptr2? -1 : (ptr1 > ptr2? 1 : 0);
|
||||
return memcmp(ref1, ref2, sizeof(HEAP_PTR));
|
||||
}
|
||||
private:
|
||||
void update_key_stats();
|
||||
|
@ -1809,6 +1809,8 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
|
||||
|
||||
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
||||
create_flags|= HA_CREATE_TMP_TABLE;
|
||||
if (ha_create_info->options & HA_CREATE_KEEP_FILES)
|
||||
create_flags|= HA_CREATE_KEEP_FILES;
|
||||
if (options & HA_OPTION_PACK_RECORD)
|
||||
create_flags|= HA_PACK_RECORD;
|
||||
if (options & HA_OPTION_CHECKSUM)
|
||||
|
@ -666,6 +666,67 @@ Arg_comparator::can_compare_as_dates(Item *a, Item *b, ulonglong *const_value)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Retrieves correct TIME value from the given item.
|
||||
|
||||
SYNOPSIS
|
||||
get_time_value()
|
||||
thd thread handle
|
||||
item_arg [in/out] item to retrieve TIME value from
|
||||
cache_arg [in/out] pointer to place to store the cache item to
|
||||
warn_item [in] unused
|
||||
is_null [out] TRUE <=> the item_arg is null
|
||||
|
||||
DESCRIPTION
|
||||
Retrieves the correct TIME value from given item for comparison by the
|
||||
compare_datetime() function.
|
||||
If item's result can be compared as longlong then its int value is used
|
||||
and a value returned by get_time function is used otherwise.
|
||||
If an item is a constant one then its value is cached and it isn't
|
||||
get parsed again. An Item_cache_int object is used for for cached values.
|
||||
It seamlessly substitutes the original item. The cache item is marked as
|
||||
non-constant to prevent re-caching it again.
|
||||
|
||||
RETURN
|
||||
obtained value
|
||||
*/
|
||||
|
||||
ulonglong
|
||||
get_time_value(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null)
|
||||
{
|
||||
ulonglong value;
|
||||
Item *item= **item_arg;
|
||||
MYSQL_TIME ltime;
|
||||
|
||||
if (item->result_as_longlong())
|
||||
{
|
||||
value= item->val_int();
|
||||
*is_null= item->null_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
*is_null= item->get_time(<ime);
|
||||
value= !*is_null ? TIME_to_ulonglong_datetime(<ime) : 0;
|
||||
}
|
||||
/*
|
||||
Do not cache GET_USER_VAR() function as its const_item() may return TRUE
|
||||
for the current thread but it still may change during the execution.
|
||||
*/
|
||||
if (item->const_item() && cache_arg && (item->type() != Item::FUNC_ITEM ||
|
||||
((Item_func*)item)->functype() != Item_func::GUSERVAR_FUNC))
|
||||
{
|
||||
Item_cache_int *cache= new Item_cache_int();
|
||||
/* Mark the cache as non-const to prevent re-caching. */
|
||||
cache->set_used_tables(1);
|
||||
cache->store(item, value);
|
||||
*cache_arg= cache;
|
||||
*item_arg= cache_arg;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
|
||||
Item **a1, Item **a2,
|
||||
Item_result type)
|
||||
@ -704,8 +765,23 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
|
||||
}
|
||||
is_nulls_eq= test(owner && owner->functype() == Item_func::EQUAL_FUNC);
|
||||
func= &Arg_comparator::compare_datetime;
|
||||
get_value_func= &get_datetime_value;
|
||||
return 0;
|
||||
}
|
||||
else if (type == STRING_RESULT && (*a)->field_type() == MYSQL_TYPE_TIME &&
|
||||
(*b)->field_type() == MYSQL_TYPE_TIME)
|
||||
{
|
||||
/* Compare TIME values as integers. */
|
||||
thd= current_thd;
|
||||
owner= owner_arg;
|
||||
a_cache= 0;
|
||||
b_cache= 0;
|
||||
is_nulls_eq= test(owner && owner->functype() == Item_func::EQUAL_FUNC);
|
||||
func= &Arg_comparator::compare_datetime;
|
||||
get_value_func= &get_time_value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return set_compare_func(owner_arg, type);
|
||||
}
|
||||
|
||||
@ -723,8 +799,10 @@ void Arg_comparator::set_datetime_cmp_func(Item **a1, Item **b1)
|
||||
b_cache= 0;
|
||||
is_nulls_eq= FALSE;
|
||||
func= &Arg_comparator::compare_datetime;
|
||||
get_value_func= &get_datetime_value;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Retrieves correct DATETIME value from given item.
|
||||
|
||||
@ -838,8 +916,8 @@ int Arg_comparator::compare_datetime()
|
||||
bool is_null= FALSE;
|
||||
ulonglong a_value, b_value;
|
||||
|
||||
/* Get DATE/DATETIME value of the 'a' item. */
|
||||
a_value= get_datetime_value(thd, &a, &a_cache, *b, &is_null);
|
||||
/* Get DATE/DATETIME/TIME value of the 'a' item. */
|
||||
a_value= (*get_value_func)(thd, &a, &a_cache, *b, &is_null);
|
||||
if (!is_nulls_eq && is_null)
|
||||
{
|
||||
if (owner)
|
||||
@ -847,8 +925,8 @@ int Arg_comparator::compare_datetime()
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Get DATE/DATETIME value of the 'b' item. */
|
||||
b_value= get_datetime_value(thd, &b, &b_cache, *a, &is_null);
|
||||
/* Get DATE/DATETIME/TIME value of the 'b' item. */
|
||||
b_value= (*get_value_func)(thd, &b, &b_cache, *a, &is_null);
|
||||
if (is_null)
|
||||
{
|
||||
if (owner)
|
||||
@ -1716,6 +1794,7 @@ void Item_func_between::fix_length_and_dec()
|
||||
THD *thd= current_thd;
|
||||
int i;
|
||||
bool datetime_found= FALSE;
|
||||
int time_items_found= 0;
|
||||
compare_as_dates= TRUE;
|
||||
|
||||
/*
|
||||
@ -1735,17 +1814,19 @@ void Item_func_between::fix_length_and_dec()
|
||||
At least one of items should be a DATE/DATETIME item and other items
|
||||
should return the STRING result.
|
||||
*/
|
||||
for (i= 0; i < 3; i++)
|
||||
if (cmp_type == STRING_RESULT)
|
||||
{
|
||||
if (args[i]->is_datetime())
|
||||
for (i= 0; i < 3; i++)
|
||||
{
|
||||
datetime_found= TRUE;
|
||||
continue;
|
||||
if (args[i]->is_datetime())
|
||||
{
|
||||
datetime_found= TRUE;
|
||||
continue;
|
||||
}
|
||||
if (args[i]->field_type() == MYSQL_TYPE_TIME &&
|
||||
args[i]->result_as_longlong())
|
||||
time_items_found++;
|
||||
}
|
||||
if (args[i]->result_type() == STRING_RESULT)
|
||||
continue;
|
||||
compare_as_dates= FALSE;
|
||||
break;
|
||||
}
|
||||
if (!datetime_found)
|
||||
compare_as_dates= FALSE;
|
||||
@ -1755,6 +1836,11 @@ void Item_func_between::fix_length_and_dec()
|
||||
ge_cmp.set_datetime_cmp_func(args, args + 1);
|
||||
le_cmp.set_datetime_cmp_func(args, args + 2);
|
||||
}
|
||||
else if (time_items_found == 3)
|
||||
{
|
||||
/* Compare TIME items as integers. */
|
||||
cmp_type= INT_RESULT;
|
||||
}
|
||||
else if (args[0]->real_item()->type() == FIELD_ITEM &&
|
||||
thd->lex->sql_command != SQLCOM_CREATE_VIEW &&
|
||||
thd->lex->sql_command != SQLCOM_SHOW_CREATE)
|
||||
|
@ -42,6 +42,8 @@ class Arg_comparator: public Sql_alloc
|
||||
bool is_nulls_eq; // TRUE <=> compare for the EQUAL_FUNC
|
||||
enum enum_date_cmp_type { CMP_DATE_DFLT= 0, CMP_DATE_WITH_DATE,
|
||||
CMP_DATE_WITH_STR, CMP_STR_WITH_DATE };
|
||||
ulonglong (*get_value_func)(THD *thd, Item ***item_arg, Item **cache_arg,
|
||||
Item *warn_item, bool *is_null);
|
||||
public:
|
||||
DTCollation cmp_collation;
|
||||
|
||||
|
@ -3068,6 +3068,7 @@ Item_func_group_concat::Item_func_group_concat(THD *thd,
|
||||
original(item)
|
||||
{
|
||||
quick_group= item->quick_group;
|
||||
result.set_charset(collation.collation);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2662,11 +2662,8 @@ longlong Item_date_typecast::val_int()
|
||||
{
|
||||
DBUG_ASSERT(fixed == 1);
|
||||
MYSQL_TIME ltime;
|
||||
if (args[0]->get_date(<ime, TIME_FUZZY_DATE))
|
||||
{
|
||||
null_value= 1;
|
||||
if ((null_value= args[0]->get_date(<ime, TIME_FUZZY_DATE)))
|
||||
return 0;
|
||||
}
|
||||
return (longlong) (ltime.year * 10000L + ltime.month * 100 + ltime.day);
|
||||
}
|
||||
|
||||
|
@ -1131,8 +1131,16 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler)
|
||||
THD *thd= current_thd;
|
||||
if (!(file= head->file->clone(thd->mem_root)))
|
||||
{
|
||||
/*
|
||||
Manually set the error flag. Note: there seems to be quite a few
|
||||
places where a failure could cause the server to "hang" the client by
|
||||
sending no response to a query. ATM those are not real errors because
|
||||
the storage engine calls in question happen to never fail with the
|
||||
existing storage engines.
|
||||
*/
|
||||
thd->net.report_error= 1; /* purecov: inspected */
|
||||
/* Caller will free the memory */
|
||||
goto failure;
|
||||
goto failure; /* purecov: inspected */
|
||||
}
|
||||
if (file->external_lock(thd, F_RDLCK))
|
||||
goto failure;
|
||||
@ -5816,6 +5824,11 @@ check_quick_select(PARAM *param,uint idx,SEL_ARG *tree)
|
||||
param->is_ror_scan is cleared if the function detects that the key scan is
|
||||
not a Rowid-Ordered Retrieval scan ( see comments for is_key_scan_ror
|
||||
function for description of which key scans are ROR scans)
|
||||
|
||||
RETURN
|
||||
#records E(#records) for given subtree
|
||||
HA_POS_ERROR if subtree cannot be used for record retrieval
|
||||
|
||||
*/
|
||||
|
||||
static ha_rows
|
||||
@ -6007,27 +6020,24 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
|
||||
ROR (Rowid Ordered Retrieval) key scan is a key scan that produces
|
||||
ordered sequence of rowids (ha_xxx::cmp_ref is the comparison function)
|
||||
|
||||
An index scan is a ROR scan if it is done using a condition in form
|
||||
This function is needed to handle a practically-important special case:
|
||||
an index scan is a ROR scan if it is done using a condition in form
|
||||
|
||||
"key1_1=c_1 AND ... AND key1_n=c_n" (1)
|
||||
"key1_1=c_1 AND ... AND key1_n=c_n"
|
||||
|
||||
where the index is defined on (key1_1, ..., key1_N [,a_1, ..., a_n])
|
||||
|
||||
and the table has a clustered Primary Key
|
||||
and the table has a clustered Primary Key defined as
|
||||
|
||||
PRIMARY KEY(a_1, ..., a_n, b1, ..., b_k) with first key parts being
|
||||
identical to uncovered parts ot the key being scanned (2)
|
||||
|
||||
Scans on HASH indexes are not ROR scans,
|
||||
any range scan on clustered primary key is ROR scan (3)
|
||||
|
||||
Check (1) is made in check_quick_keys()
|
||||
Check (3) is made check_quick_select()
|
||||
Check (2) is made by this function.
|
||||
PRIMARY KEY(a_1, ..., a_n, b1, ..., b_k)
|
||||
|
||||
i.e. the first key parts of it are identical to uncovered parts ot the
|
||||
key being scanned. This function assumes that the index flags do not
|
||||
include HA_KEY_SCAN_NOT_ROR flag (that is checked elsewhere).
|
||||
|
||||
RETURN
|
||||
TRUE If the scan is ROR-scan
|
||||
FALSE otherwise
|
||||
TRUE The scan is ROR-scan
|
||||
FALSE Otherwise
|
||||
*/
|
||||
|
||||
static bool is_key_scan_ror(PARAM *param, uint keynr, uint8 nparts)
|
||||
|
@ -592,6 +592,10 @@ sys_var_const_str sys_license("license", STRINGIFY_ARG(LICENSE));
|
||||
/* Global read-only variable containing hostname */
|
||||
sys_var_const_str sys_hostname("hostname", glob_hostname);
|
||||
|
||||
sys_var_thd_bool sys_keep_files_on_create("keep_files_on_create",
|
||||
&SV::keep_files_on_create);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@ -637,6 +641,7 @@ sys_var *sys_variables[]=
|
||||
&sys_delayed_insert_limit,
|
||||
&sys_delayed_insert_timeout,
|
||||
&sys_delayed_queue_size,
|
||||
&sys_keep_files_on_create,
|
||||
&sys_error_count,
|
||||
&sys_expire_logs_days,
|
||||
&sys_flush,
|
||||
@ -849,6 +854,7 @@ struct show_var_st init_vars[]= {
|
||||
{sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
|
||||
{sys_delayed_queue_size.name,(char*) &sys_delayed_queue_size, SHOW_SYS},
|
||||
{sys_div_precincrement.name,(char*) &sys_div_precincrement,SHOW_SYS},
|
||||
{sys_keep_files_on_create.name,(char*) &sys_keep_files_on_create, SHOW_SYS},
|
||||
{sys_engine_condition_pushdown.name,
|
||||
(char*) &sys_engine_condition_pushdown, SHOW_SYS},
|
||||
{sys_expire_logs_days.name, (char*) &sys_expire_logs_days, SHOW_SYS},
|
||||
|
@ -97,7 +97,7 @@
|
||||
0040 0041 0042 0043 0044 0045 0046 0047 0048 0049 004A 004B 004C 004D 004E 004F
|
||||
0050 0051 0052 0053 0054 0055 0056 0057 0058 0059 005A 005B 005C 005D 005E 005F
|
||||
0060 0061 0062 0063 0064 0065 0066 0067 0068 0069 006A 006B 006C 006D 006E 006F
|
||||
0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 0000
|
||||
0070 0071 0072 0073 0074 0075 0076 0077 0078 0079 007A 007B 007C 007D 007E 007F
|
||||
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
|
||||
0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000
|
||||
|
@ -566,6 +566,7 @@ struct system_variables
|
||||
my_bool new_mode;
|
||||
my_bool query_cache_wlock_invalidate;
|
||||
my_bool engine_condition_pushdown;
|
||||
my_bool keep_files_on_create;
|
||||
|
||||
#ifdef HAVE_INNOBASE_DB
|
||||
my_bool innodb_table_locks;
|
||||
|
@ -8486,9 +8486,15 @@ static void restore_prev_nj_state(JOIN_TAB *last)
|
||||
{
|
||||
TABLE_LIST *last_emb= last->table->pos_in_table_list->embedding;
|
||||
JOIN *join= last->join;
|
||||
while (last_emb && !(--last_emb->nested_join->counter))
|
||||
while (last_emb)
|
||||
{
|
||||
join->cur_embedding_map &= last_emb->nested_join->nj_map;
|
||||
if (!(--last_emb->nested_join->counter))
|
||||
join->cur_embedding_map&= ~last_emb->nested_join->nj_map;
|
||||
else if (last_emb->nested_join->join_list.elements-1 ==
|
||||
last_emb->nested_join->counter)
|
||||
join->cur_embedding_map|= last_emb->nested_join->nj_map;
|
||||
else
|
||||
break;
|
||||
last_emb= last_emb->embedding;
|
||||
}
|
||||
}
|
||||
|
@ -2841,6 +2841,8 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST *src_table,
|
||||
and temporary tables).
|
||||
*/
|
||||
*fn_ext(dst_path)= 0;
|
||||
if (thd->variables.keep_files_on_create)
|
||||
create_info->options|= HA_CREATE_KEEP_FILES;
|
||||
err= ha_create_table(dst_path, create_info, 1);
|
||||
|
||||
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
||||
|
@ -285,6 +285,8 @@ int rea_create_table(THD *thd, my_string file_name,
|
||||
if (mysql_create_frm(thd, file_name, db, table, create_info,
|
||||
create_fields, keys, key_info, NULL))
|
||||
DBUG_RETURN(1);
|
||||
if (thd->variables.keep_files_on_create)
|
||||
create_info->options|= HA_CREATE_KEEP_FILES;
|
||||
if (!create_info->frm_only && ha_create_table(file_name,create_info,0))
|
||||
{
|
||||
my_delete(file_name,MYF(0));
|
||||
|
@ -243,6 +243,28 @@ void dispcset(FILE *f,CHARSET_INFO *cs)
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
fprint_copyright(FILE *file)
|
||||
{
|
||||
fprintf(file,
|
||||
"/* Copyright (C) 2000-2007 MySQL AB\n"
|
||||
"\n"
|
||||
" This program is free software; you can redistribute it and/or modify\n"
|
||||
" it under the terms of the GNU General Public License as published by\n"
|
||||
" the Free Software Foundation; version 2 of the License.\n"
|
||||
"\n"
|
||||
" This program is distributed in the hope that it will be useful,\n"
|
||||
" but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
||||
" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
||||
" GNU General Public License for more details.\n"
|
||||
"\n"
|
||||
" You should have received a copy of the GNU General Public License\n"
|
||||
" along with this program; if not, write to the Free Software\n"
|
||||
" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */\n"
|
||||
"\n");
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char **argv __attribute__((unused)))
|
||||
{
|
||||
@ -283,6 +305,7 @@ main(int argc, char **argv __attribute__((unused)))
|
||||
"directory:\n");
|
||||
fprintf(f, " ./conf_to_src ../sql/share/charsets/ > FILE\n");
|
||||
fprintf(f, "*/\n\n");
|
||||
fprint_copyright(f);
|
||||
fprintf(f,"#include <my_global.h>\n");
|
||||
fprintf(f,"#include <m_ctype.h>\n\n");
|
||||
|
||||
|
@ -250,9 +250,16 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
||||
const uchar *a_end= a + a_length;
|
||||
const uchar *b_end= b + b_length;
|
||||
int res= my_strnncoll_cp932_internal(cs, &a, a_length, &b, b_length);
|
||||
|
||||
#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
|
||||
diff_if_only_endspace_difference= 0;
|
||||
#endif
|
||||
|
||||
if (!res && (a != a_end || b != b_end))
|
||||
{
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
if (diff_if_only_endspace_difference)
|
||||
res= 1; /* Assume 'a' is bigger */
|
||||
/*
|
||||
Check the next not space character of the longer key. If it's < ' ',
|
||||
then it's smaller than the other key.
|
||||
@ -263,11 +270,12 @@ static int my_strnncollsp_cp932(CHARSET_INFO *cs __attribute__((unused)),
|
||||
a_end= b_end;
|
||||
a= b;
|
||||
swap= -1; /* swap sign of result */
|
||||
res= -res;
|
||||
}
|
||||
for (; a < a_end ; a++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
return ((int) *a - (int) ' ') ^ swap;
|
||||
if (*a != (uchar) ' ')
|
||||
return (*a < (uchar) ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
|
@ -5,7 +5,8 @@
|
||||
To re-generate, run the following in the strings/ directory:
|
||||
./conf_to_src ../sql/share/charsets/ > FILE
|
||||
*/
|
||||
/* Copyright (C) 2000-2003 MySQL AB
|
||||
|
||||
/* Copyright (C) 2000-2007 MySQL AB
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -922,7 +923,7 @@ uint16 to_uni_ascii_general_ci[] = {
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
|
||||
0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
|
||||
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x0000,
|
||||
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
@ -4603,7 +4604,7 @@ uint16 to_uni_ascii_bin[] = {
|
||||
0x0060,0x0061,0x0062,0x0063,0x0064,0x0065,0x0066,0x0067,
|
||||
0x0068,0x0069,0x006A,0x006B,0x006C,0x006D,0x006E,0x006F,
|
||||
0x0070,0x0071,0x0072,0x0073,0x0074,0x0075,0x0076,0x0077,
|
||||
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x0000,
|
||||
0x0078,0x0079,0x007A,0x007B,0x007C,0x007D,0x007E,0x007F,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
|
||||
|
@ -179,7 +179,7 @@ int my_strnncollsp_simple(CHARSET_INFO * cs, const uchar *a, uint a_length,
|
||||
}
|
||||
for (end= a + a_length-length; a < end ; a++)
|
||||
{
|
||||
if (*a != ' ')
|
||||
if (map[*a] != ' ')
|
||||
return (map[*a] < ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
|
@ -2802,16 +2802,19 @@ static int my_strnncoll_utf8_cs(CHARSET_INFO *cs,
|
||||
static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
||||
const uchar *s, uint slen,
|
||||
const uchar *t, uint tlen,
|
||||
my_bool diff_if_only_endspace_difference
|
||||
__attribute__((unused)))
|
||||
my_bool diff_if_only_endspace_difference)
|
||||
{
|
||||
int s_res,t_res;
|
||||
my_wc_t s_wc,t_wc;
|
||||
const uchar *se= s+slen;
|
||||
const uchar *te= t+tlen;
|
||||
int save_diff = 0;
|
||||
int s_res, t_res, res;
|
||||
my_wc_t s_wc, t_wc;
|
||||
const uchar *se= s + slen;
|
||||
const uchar *te= t + tlen;
|
||||
int save_diff= 0;
|
||||
MY_UNICASE_INFO **uni_plane= cs->caseinfo;
|
||||
|
||||
|
||||
#ifndef VARCHAR_WITH_DIFF_ENDSPACE_ARE_DIFFERENT_FOR_UNIQUE
|
||||
diff_if_only_endspace_difference= 0;
|
||||
#endif
|
||||
|
||||
while ( s < se && t < te )
|
||||
{
|
||||
int plane;
|
||||
@ -2843,16 +2846,20 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
||||
|
||||
slen= se-s;
|
||||
tlen= te-t;
|
||||
res= 0;
|
||||
|
||||
if (slen != tlen)
|
||||
{
|
||||
int swap= 0;
|
||||
int swap= 1;
|
||||
if (diff_if_only_endspace_difference)
|
||||
res= 1; /* Assume 'a' is bigger */
|
||||
if (slen < tlen)
|
||||
{
|
||||
slen= tlen;
|
||||
s= t;
|
||||
se= te;
|
||||
swap= -1;
|
||||
res= -res;
|
||||
}
|
||||
/*
|
||||
This following loop uses the fact that in UTF-8
|
||||
@ -2866,8 +2873,8 @@ static int my_strnncollsp_utf8_cs(CHARSET_INFO *cs,
|
||||
*/
|
||||
for ( ; s < se; s++)
|
||||
{
|
||||
if (*s != ' ')
|
||||
return ((int)*s - (int) ' ') ^ swap;
|
||||
if (*s != (uchar) ' ')
|
||||
return (*s < (uchar) ' ') ? -swap : swap;
|
||||
}
|
||||
}
|
||||
return save_diff;
|
||||
|
Loading…
x
Reference in New Issue
Block a user