Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
85603b2e
Commit
85603b2e
authored
Jul 13, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge gleb.loc:/home/uchum/work/bk/5.0
into gleb.loc:/home/uchum/work/bk/5.0-opt
parents
bf30f9e1
2a0498c0
Changes
28
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
522 additions
and
67 deletions
+522
-67
client/mysql.cc
client/mysql.cc
+6
-1
include/my_base.h
include/my_base.h
+1
-0
myisam/mi_create.c
myisam/mi_create.c
+2
-2
myisam/sp_key.c
myisam/sp_key.c
+29
-42
mysql-test/r/ctype_collate.result
mysql-test/r/ctype_collate.result
+8
-0
mysql-test/r/gis-rtree.result
mysql-test/r/gis-rtree.result
+13
-0
mysql-test/r/join_nested.result
mysql-test/r/join_nested.result
+111
-0
mysql-test/r/symlink.result
mysql-test/r/symlink.result
+22
-0
mysql-test/r/type_enum.result
mysql-test/r/type_enum.result
+20
-0
mysql-test/r/type_ranges.result
mysql-test/r/type_ranges.result
+0
-4
mysql-test/r/type_time.result
mysql-test/r/type_time.result
+24
-0
mysql-test/t/create_not_windows.test
mysql-test/t/create_not_windows.test
+1
-0
mysql-test/t/ctype_collate.test
mysql-test/t/ctype_collate.test
+11
-0
mysql-test/t/gis-rtree.test
mysql-test/t/gis-rtree.test
+19
-0
mysql-test/t/join_nested.test
mysql-test/t/join_nested.test
+114
-0
mysql-test/t/symlink.test
mysql-test/t/symlink.test
+38
-0
mysql-test/t/type_enum.test
mysql-test/t/type_enum.test
+18
-0
mysql-test/t/type_time.test
mysql-test/t/type_time.test
+18
-0
mysys/my_conio.c
mysys/my_conio.c
+5
-2
sql/field_conv.cc
sql/field_conv.cc
+12
-5
sql/ha_myisam.cc
sql/ha_myisam.cc
+2
-0
sql/item_cmpfunc.cc
sql/item_cmpfunc.cc
+28
-8
sql/set_var.cc
sql/set_var.cc
+6
-0
sql/sql_class.h
sql/sql_class.h
+1
-0
sql/sql_select.cc
sql/sql_select.cc
+8
-2
sql/sql_table.cc
sql/sql_table.cc
+2
-0
sql/unireg.cc
sql/unireg.cc
+2
-0
strings/ctype-simple.c
strings/ctype-simple.c
+1
-1
No files found.
client/mysql.cc
View file @
85603b2e
...
...
@@ -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 */
...
...
include/my_base.h
View file @
85603b2e
...
...
@@ -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
/*
...
...
myisam/mi_create.c
View file @
85603b2e
...
...
@@ -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
,
...
...
myisam/sp_key.c
View file @
85603b2e
...
...
@@ -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
;
if
(
keyseg
->
flag
&
HA_SWAP_KEY
)
{
val
=
mbr
[
start
/
sizeof
(
double
)];
#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
;
}
}
if
(
isnan
(
val
))
{
bzero
(
key
,
length
);
key
+=
length
;
len
+=
length
;
continue
;
}
#endif
pos
+=
length
;
while
(
length
--
)
{
if
(
keyseg
->
flag
&
HA_SWAP_KEY
)
{
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
;
...
...
mysql-test/r/ctype_collate.result
View file @
85603b2e
...
...
@@ -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;
mysql-test/r/gis-rtree.result
View file @
85603b2e
...
...
@@ -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.
mysql-test/r/join_nested.result
View file @
85603b2e
...
...
@@ -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
mysql-test/r/symlink.result
View file @
85603b2e
...
...
@@ -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
mysql-test/r/type_enum.result
View file @
85603b2e
...
...
@@ -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;
...
...
mysql-test/r/type_ranges.result
View file @
85603b2e
...
...
@@ -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
...
...
mysql-test/r/type_time.result
View file @
85603b2e
...
...
@@ -85,3 +85,27 @@ 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, 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;
mysql-test/t/create_not_windows.test
View file @
85603b2e
...
...
@@ -17,4 +17,5 @@ primary key (_id)
show
create
table
`about:text`
;
drop
table
`about:text`
;
# End of 5.0 tests
mysql-test/t/ctype_collate.test
View file @
85603b2e
...
...
@@ -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
;
mysql-test/t/gis-rtree.test
View file @
85603b2e
...
...
@@ -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
.
mysql-test/t/join_nested.test
View file @
85603b2e
...
...
@@ -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
mysql-test/t/symlink.test
View file @
85603b2e
...
...
@@ -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
mysql-test/t/type_enum.test
View file @
85603b2e
...
...
@@ -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
;
...
...
mysql-test/t/type_time.test
View file @
85603b2e
...
...
@@ -40,3 +40,21 @@ 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
);
#
# 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
;
mysys/my_conio.c
View file @
85603b2e
...
...
@@ -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
);
...
...
sql/field_conv.cc
View file @
85603b2e
...
...
@@ -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
());
...
...
sql/ha_myisam.cc
View file @
85603b2e
...
...
@@ -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
)
...
...
sql/item_cmpfunc.cc
View file @
85603b2e
...
...
@@ -706,6 +706,18 @@ int Arg_comparator::set_cmp_func(Item_bool_func2 *owner_arg,
func
=
&
Arg_comparator
::
compare_datetime
;
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
;
func
=
((
test
(
owner
&&
owner
->
functype
()
==
Item_func
::
EQUAL_FUNC
))
?
&
Arg_comparator
::
compare_e_int
:
&
Arg_comparator
::
compare_int_unsigned
);
return
0
;
}
return
set_compare_func
(
owner_arg
,
type
);
}
...
...
@@ -1716,6 +1728,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 +1748,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 +1770,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
)
...
...
sql/set_var.cc
View file @
85603b2e
...
...
@@ -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
},
...
...
sql/sql_class.h
View file @
85603b2e
...
...
@@ -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
;
...
...
sql/sql_select.cc
View file @
85603b2e
...
...
@@ -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
;
}
}
...
...
sql/sql_table.cc
View file @
85603b2e
...
...
@@ -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
)
...
...
sql/unireg.cc
View file @
85603b2e
...
...
@@ -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
));
...
...
strings/ctype-simple.c
View file @
85603b2e
...
...
@@ -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
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment