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
d02e09ee
Commit
d02e09ee
authored
Jan 14, 2007
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into mysql.com:/home/hf/work/my51-24186
parents
2cc1c479
94046b73
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
177 additions
and
0 deletions
+177
-0
mysql-test/r/partition.result
mysql-test/r/partition.result
+81
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+93
-0
sql/ha_partition.cc
sql/ha_partition.cc
+3
-0
No files found.
mysql-test/r/partition.result
View file @
d02e09ee
...
...
@@ -1138,4 +1138,85 @@ PARTITION p_100 VALUES LESS THAN (100),
PARTITION p_X VALUES LESS THAN MAXVALUE
);
drop table t1;
CREATE TABLE t2 (
taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
id int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (id,taken),
KEY taken (taken)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES
('2006-09-27 21:50:01',16421),
('2006-10-02 21:50:01',16421),
('2006-09-27 21:50:01',19092),
('2006-09-28 21:50:01',19092),
('2006-09-29 21:50:01',19092),
('2006-09-30 21:50:01',19092),
('2006-10-01 21:50:01',19092),
('2006-10-02 21:50:01',19092),
('2006-09-27 21:50:01',22589),
('2006-09-29 21:50:01',22589);
CREATE TABLE t1 (
id int(8) NOT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t1 VALUES
(16421),
(19092),
(22589);
CREATE TABLE t4 (
taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
id int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (id,taken),
KEY taken (taken)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (to_days(taken))
(
PARTITION p01 VALUES LESS THAN (732920) ,
PARTITION p02 VALUES LESS THAN (732950) ,
PARTITION p03 VALUES LESS THAN MAXVALUE ) ;
INSERT INTO t4 select * from t2;
set @f_date='2006-09-28';
set @t_date='2006-10-02';
SELECT t1.id AS MyISAM_part
FROM t1
WHERE t1.id IN (
SELECT distinct id
FROM t4
WHERE taken BETWEEN @f_date AND date_add(@t_date, INTERVAL 1 DAY))
ORDER BY t1.id
;
MyISAM_part
16421
19092
22589
drop table t1, t2, t4;
CREATE TABLE t1 (
taken datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
id int(11) NOT NULL DEFAULT '0',
status varchar(20) NOT NULL DEFAULT '',
PRIMARY KEY (id,taken)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE (to_days(taken))
(
PARTITION p15 VALUES LESS THAN (732950) ,
PARTITION p16 VALUES LESS THAN MAXVALUE ) ;
INSERT INTO t1 VALUES
('2006-09-27 21:50:01',22589,'Open'),
('2006-09-29 21:50:01',22589,'Verified');
DROP TABLE IF EXISTS t2;
Warnings:
Note 1051 Unknown table 't2'
CREATE TABLE t2 (
id int(8) NOT NULL,
severity tinyint(4) NOT NULL DEFAULT '0',
priority tinyint(4) NOT NULL DEFAULT '0',
status varchar(20) DEFAULT NULL,
alien tinyint(4) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
INSERT INTO t2 VALUES
(22589,1,1,'Need Feedback',0);
SELECT t2.id FROM t2 WHERE t2.id IN (SELECT id FROM t1 WHERE status = 'Verified');
id
22589
drop table t1, t2;
End of 5.1 tests
mysql-test/t/partition.test
View file @
d02e09ee
...
...
@@ -1370,4 +1370,97 @@ REORGANIZE PARTITION p_X INTO (
drop
table
t1
;
#
# Bug #24186 (nested query across partitions returns fewer records)
#
CREATE
TABLE
t2
(
taken
datetime
NOT
NULL
DEFAULT
'0000-00-00 00:00:00'
,
id
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
PRIMARY
KEY
(
id
,
taken
),
KEY
taken
(
taken
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t2
VALUES
(
'2006-09-27 21:50:01'
,
16421
),
(
'2006-10-02 21:50:01'
,
16421
),
(
'2006-09-27 21:50:01'
,
19092
),
(
'2006-09-28 21:50:01'
,
19092
),
(
'2006-09-29 21:50:01'
,
19092
),
(
'2006-09-30 21:50:01'
,
19092
),
(
'2006-10-01 21:50:01'
,
19092
),
(
'2006-10-02 21:50:01'
,
19092
),
(
'2006-09-27 21:50:01'
,
22589
),
(
'2006-09-29 21:50:01'
,
22589
);
CREATE
TABLE
t1
(
id
int
(
8
)
NOT
NULL
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t1
VALUES
(
16421
),
(
19092
),
(
22589
);
CREATE
TABLE
t4
(
taken
datetime
NOT
NULL
DEFAULT
'0000-00-00 00:00:00'
,
id
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
PRIMARY
KEY
(
id
,
taken
),
KEY
taken
(
taken
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
PARTITION
BY
RANGE
(
to_days
(
taken
))
(
PARTITION
p01
VALUES
LESS
THAN
(
732920
)
,
PARTITION
p02
VALUES
LESS
THAN
(
732950
)
,
PARTITION
p03
VALUES
LESS
THAN
MAXVALUE
)
;
INSERT
INTO
t4
select
*
from
t2
;
set
@
f_date
=
'2006-09-28'
;
set
@
t_date
=
'2006-10-02'
;
SELECT
t1
.
id
AS
MyISAM_part
FROM
t1
WHERE
t1
.
id
IN
(
SELECT
distinct
id
FROM
t4
WHERE
taken
BETWEEN
@
f_date
AND
date_add
(
@
t_date
,
INTERVAL
1
DAY
))
ORDER
BY
t1
.
id
;
drop
table
t1
,
t2
,
t4
;
CREATE
TABLE
t1
(
taken
datetime
NOT
NULL
DEFAULT
'0000-00-00 00:00:00'
,
id
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
status
varchar
(
20
)
NOT
NULL
DEFAULT
''
,
PRIMARY
KEY
(
id
,
taken
)
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
PARTITION
BY
RANGE
(
to_days
(
taken
))
(
PARTITION
p15
VALUES
LESS
THAN
(
732950
)
,
PARTITION
p16
VALUES
LESS
THAN
MAXVALUE
)
;
INSERT
INTO
t1
VALUES
(
'2006-09-27 21:50:01'
,
22589
,
'Open'
),
(
'2006-09-29 21:50:01'
,
22589
,
'Verified'
);
DROP
TABLE
IF
EXISTS
t2
;
CREATE
TABLE
t2
(
id
int
(
8
)
NOT
NULL
,
severity
tinyint
(
4
)
NOT
NULL
DEFAULT
'0'
,
priority
tinyint
(
4
)
NOT
NULL
DEFAULT
'0'
,
status
varchar
(
20
)
DEFAULT
NULL
,
alien
tinyint
(
4
)
NOT
NULL
)
ENGINE
=
MyISAM
DEFAULT
CHARSET
=
latin1
;
INSERT
INTO
t2
VALUES
(
22589
,
1
,
1
,
'Need Feedback'
,
0
);
SELECT
t2
.
id
FROM
t2
WHERE
t2
.
id
IN
(
SELECT
id
FROM
t1
WHERE
status
=
'Verified'
);
drop
table
t1
,
t2
;
--
echo
End
of
5.1
tests
sql/ha_partition.cc
View file @
d02e09ee
...
...
@@ -4015,6 +4015,7 @@ int ha_partition::handle_ordered_index_scan(byte *buf, bool reverse_order)
m_queue
.
elements
=
j
;
queue_fix
(
&
m_queue
);
return_top_record
(
buf
);
table
->
status
=
0
;
DBUG_PRINT
(
"info"
,
(
"Record returned from partition %d"
,
m_top_entry
));
DBUG_RETURN
(
0
);
}
...
...
@@ -4083,6 +4084,7 @@ int ha_partition::handle_ordered_next(byte *buf, bool is_next_same)
DBUG_PRINT
(
"info"
,
(
"Record returned from partition %u (2)"
,
m_top_entry
));
return_top_record
(
buf
);
table
->
status
=
0
;
error
=
0
;
}
}
...
...
@@ -4126,6 +4128,7 @@ int ha_partition::handle_ordered_prev(byte *buf)
DBUG_PRINT
(
"info"
,
(
"Record returned from partition %d (2)"
,
m_top_entry
));
error
=
0
;
table
->
status
=
0
;
}
}
DBUG_RETURN
(
error
);
...
...
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