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
8b18b6d7
Commit
8b18b6d7
authored
May 24, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
923da1e8
c1966505
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
7 deletions
+76
-7
mysql-test/r/partition_column.result
mysql-test/r/partition_column.result
+42
-2
mysql-test/t/partition_column.test
mysql-test/t/partition_column.test
+26
-0
sql/sql_partition.cc
sql/sql_partition.cc
+8
-5
No files found.
mysql-test/r/partition_column.result
View file @
8b18b6d7
drop table if exists t1;
#
# Bug#52815: LIST COLUMNS doesn't insert rows in correct partition
# if muliple columns used
CREATE TABLE t1 (
id INT NOT NULL,
name VARCHAR(255),
department VARCHAR(10),
country VARCHAR(255)
) PARTITION BY LIST COLUMNS (department, country) (
PARTITION first_office VALUES IN (('dep1', 'Russia'), ('dep1', 'Croatia')),
PARTITION second_office VALUES IN (('dep2', 'Russia'))
);
INSERT INTO t1 VALUES(1, 'Ann', 'dep1', 'Russia');
INSERT INTO t1 VALUES(2, 'Bob', 'dep1', 'Croatia');
INSERT INTO t1 VALUES(3, 'Cecil', 'dep2', 'Russia');
INSERT INTO t1 VALUES(3, 'Dan', 'dep2', 'Croatia');
ERROR HY000: Table has no partition for value from column_list
SELECT PARTITION_NAME,TABLE_ROWS
FROM INFORMATION_SCHEMA.PARTITIONS
WHERE TABLE_NAME = 't1';
PARTITION_NAME TABLE_ROWS
first_office 2
second_office 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`name` varchar(255) DEFAULT NULL,
`department` varchar(10) DEFAULT NULL,
`country` varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50500 PARTITION BY LIST COLUMNS(department,country)
(PARTITION first_office VALUES IN (('dep1','Russia'),('dep1','Croatia')) ENGINE = MyISAM,
PARTITION second_office VALUES IN (('dep2','Russia')) ENGINE = MyISAM) */
SELECT * FROM t1 WHERE department = 'dep2' and country = 'Croatia';
id name department country
SELECT * FROM t1 WHERE department = 'dep1' and country = 'Croatia';
id name department country
2 Bob dep1 Croatia
DROP TABLE t1;
CREATE TABLE t1 (a DECIMAL)
PARTITION BY RANGE COLUMNS (a)
(PARTITION p0 VALUES LESS THAN (0));
...
...
@@ -298,11 +338,11 @@ select * from t1 where a > 8;
a b
select * from t1 where a not between 8 and 8;
a b
1 NULL
2 NULL
1 1
2 2
3 NULL
1 NULL
1 1
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
...
...
mysql-test/t/partition_column.test
View file @
8b18b6d7
...
...
@@ -8,6 +8,32 @@
drop
table
if
exists
t1
;
--
enable_warnings
--
echo
#
--
echo
# Bug#52815: LIST COLUMNS doesn't insert rows in correct partition
--
echo
# if muliple columns used
CREATE
TABLE
t1
(
id
INT
NOT
NULL
,
name
VARCHAR
(
255
),
department
VARCHAR
(
10
),
country
VARCHAR
(
255
)
)
PARTITION
BY
LIST
COLUMNS
(
department
,
country
)
(
PARTITION
first_office
VALUES
IN
((
'dep1'
,
'Russia'
),
(
'dep1'
,
'Croatia'
)),
PARTITION
second_office
VALUES
IN
((
'dep2'
,
'Russia'
))
);
INSERT
INTO
t1
VALUES
(
1
,
'Ann'
,
'dep1'
,
'Russia'
);
INSERT
INTO
t1
VALUES
(
2
,
'Bob'
,
'dep1'
,
'Croatia'
);
INSERT
INTO
t1
VALUES
(
3
,
'Cecil'
,
'dep2'
,
'Russia'
);
--
error
ER_NO_PARTITION_FOR_GIVEN_VALUE
INSERT
INTO
t1
VALUES
(
3
,
'Dan'
,
'dep2'
,
'Croatia'
);
SELECT
PARTITION_NAME
,
TABLE_ROWS
FROM
INFORMATION_SCHEMA
.
PARTITIONS
WHERE
TABLE_NAME
=
't1'
;
SHOW
CREATE
TABLE
t1
;
SELECT
*
FROM
t1
WHERE
department
=
'dep2'
and
country
=
'Croatia'
;
SELECT
*
FROM
t1
WHERE
department
=
'dep1'
and
country
=
'Croatia'
;
DROP
TABLE
t1
;
#
# Bug#51347: assertion with show create table + partition by columns
# on decimal column
...
...
sql/sql_partition.cc
View file @
8b18b6d7
...
...
@@ -3096,7 +3096,7 @@ int get_partition_id_list_col(partition_info *part_info,
}
else
{
*
part_id
=
(
uint32
)
list_col_array
[
list_index
].
partition_id
;
*
part_id
=
(
uint32
)
list_col_array
[
list_index
*
num_columns
].
partition_id
;
DBUG_RETURN
(
0
);
}
}
...
...
@@ -7701,7 +7701,7 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
DESCRIPTION
This implementation of PARTITION_ITERATOR::get_next() is special for
LIST partitioning: it enumerates partition ids in
part_info->list_array[i] (list_col_array[i] for COLUMNS LIST
part_info->list_array[i] (list_col_array[i
*cols
] for COLUMNS LIST
partitioning) where i runs over [min_idx, max_idx] interval.
The function conforms to partition_iter_func type.
...
...
@@ -7727,9 +7727,12 @@ uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter)
{
partition_info
*
part_info
=
part_iter
->
part_info
;
uint32
num_part
=
part_iter
->
part_nums
.
cur
++
;
return
part_info
->
column_list
?
part_info
->
list_col_array
[
num_part
].
partition_id
:
part_info
->
list_array
[
num_part
].
partition_id
;
if
(
part_info
->
column_list
)
{
uint
num_columns
=
part_info
->
part_field_list
.
elements
;
return
part_info
->
list_col_array
[
num_part
*
num_columns
].
partition_id
;
}
return
part_info
->
list_array
[
num_part
].
partition_id
;
}
}
...
...
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