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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
8db43e66
Commit
8db43e66
authored
May 25, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
2abf030a
d347714d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
4 deletions
+69
-4
mysql-test/r/partition.result
mysql-test/r/partition.result
+42
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+22
-0
sql/sql_show.cc
sql/sql_show.cc
+5
-4
No files found.
mysql-test/r/partition.result
View file @
8db43e66
drop table if exists t1, t2;
# Bug#39338: Fieldnames in
# INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped
# NOTE: the partition expression is saved as a string, so changing from
# normal quotes to ansi quotes does not change the expression, only
# for partition by KEY.
CREATE TABLE t1 (
ID int(11) NOT NULL,
`aaaa,aaaaa` tinyint(3) UNSIGNED NOT NULL DEFAULT '0',
ddddddddd int(11) NOT NULL DEFAULT '0',
new_field0 varchar(50),
PRIMARY KEY(ID, `aaaa,aaaaa`, ddddddddd))
PARTITION BY RANGE(ID)
PARTITIONS 3
SUBPARTITION BY LINEAR KEY(ID,`aaaa,aaaaa`)
SUBPARTITIONS 2 (
PARTITION p01 VALUES LESS THAN(100),
PARTITION p11 VALUES LESS THAN(200),
PARTITION p21 VALUES LESS THAN MAXVALUE);
SELECT PARTITION_EXPRESSION, SUBPARTITION_EXPRESSION FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_NAME='t1';
PARTITION_EXPRESSION SUBPARTITION_EXPRESSION
ID `ID`,`aaaa,aaaaa`
ID `ID`,`aaaa,aaaaa`
ID `ID`,`aaaa,aaaaa`
ID `ID`,`aaaa,aaaaa`
ID `ID`,`aaaa,aaaaa`
ID `ID`,`aaaa,aaaaa`
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ID` int(11) NOT NULL,
`aaaa,aaaaa` tinyint(3) unsigned NOT NULL DEFAULT '0',
`ddddddddd` int(11) NOT NULL DEFAULT '0',
`new_field0` varchar(50) DEFAULT NULL,
PRIMARY KEY (`ID`,`aaaa,aaaaa`,`ddddddddd`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
/*!50100 PARTITION BY RANGE (ID)
SUBPARTITION BY LINEAR KEY (ID,`aaaa,aaaaa`)
SUBPARTITIONS 2
(PARTITION p01 VALUES LESS THAN (100) ENGINE = MyISAM,
PARTITION p11 VALUES LESS THAN (200) ENGINE = MyISAM,
PARTITION p21 VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */
drop table t1;
CREATE TABLE t1 (a INT, b INT)
PARTITION BY LIST (a)
SUBPARTITION BY HASH (b)
...
...
mysql-test/t/partition.test
View file @
8db43e66
...
...
@@ -14,6 +14,28 @@
drop
table
if
exists
t1
,
t2
;
--
enable_warnings
--
echo
# Bug#39338: Fieldnames in
--
echo
# INFORMATIONSCHEMA.PARTITIONS.PARTITION_EXPRESSION become unescaped
--
echo
# NOTE: the partition expression is saved as a string, so changing from
--
echo
# normal quotes to ansi quotes does not change the expression, only
--
echo
# for partition by KEY.
CREATE
TABLE
t1
(
ID
int
(
11
)
NOT
NULL
,
`aaaa,aaaaa`
tinyint
(
3
)
UNSIGNED
NOT
NULL
DEFAULT
'0'
,
ddddddddd
int
(
11
)
NOT
NULL
DEFAULT
'0'
,
new_field0
varchar
(
50
),
PRIMARY
KEY
(
ID
,
`aaaa,aaaaa`
,
ddddddddd
))
PARTITION
BY
RANGE
(
ID
)
PARTITIONS
3
SUBPARTITION
BY
LINEAR
KEY
(
ID
,
`aaaa,aaaaa`
)
SUBPARTITIONS
2
(
PARTITION
p01
VALUES
LESS
THAN
(
100
),
PARTITION
p11
VALUES
LESS
THAN
(
200
),
PARTITION
p21
VALUES
LESS
THAN
MAXVALUE
);
SELECT
PARTITION_EXPRESSION
,
SUBPARTITION_EXPRESSION
FROM
INFORMATION_SCHEMA
.
PARTITIONS
WHERE
TABLE_NAME
=
't1'
;
show
create
table
t1
;
drop
table
t1
;
#
# Bug#48276: can't add column if subpartition exists
CREATE
TABLE
t1
(
a
INT
,
b
INT
)
...
...
sql/sql_show.cc
View file @
8db43e66
...
...
@@ -5238,7 +5238,8 @@ static int get_schema_key_column_usage_record(THD *thd,
#ifdef WITH_PARTITION_STORAGE_ENGINE
static
void
collect_partition_expr
(
List
<
char
>
&
field_list
,
String
*
str
)
static
void
collect_partition_expr
(
THD
*
thd
,
List
<
char
>
&
field_list
,
String
*
str
)
{
List_iterator
<
char
>
part_it
(
field_list
);
ulong
no_fields
=
field_list
.
elements
;
...
...
@@ -5246,7 +5247,7 @@ static void collect_partition_expr(List<char> &field_list, String *str)
str
->
length
(
0
);
while
((
field_str
=
part_it
++
))
{
str
->
append
(
field_str
);
append_identifier
(
thd
,
str
,
field_str
,
strlen
(
field_str
)
);
if
(
--
no_fields
!=
0
)
str
->
append
(
","
);
}
...
...
@@ -5513,7 +5514,7 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables,
}
else
if
(
part_info
->
list_of_part_fields
)
{
collect_partition_expr
(
part_info
->
part_field_list
,
&
tmp_str
);
collect_partition_expr
(
thd
,
part_info
->
part_field_list
,
&
tmp_str
);
table
->
field
[
9
]
->
store
(
tmp_str
.
ptr
(),
tmp_str
.
length
(),
cs
);
}
table
->
field
[
9
]
->
set_notnull
();
...
...
@@ -5542,7 +5543,7 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables,
}
else
if
(
part_info
->
list_of_subpart_fields
)
{
collect_partition_expr
(
part_info
->
subpart_field_list
,
&
tmp_str
);
collect_partition_expr
(
thd
,
part_info
->
subpart_field_list
,
&
tmp_str
);
table
->
field
[
10
]
->
store
(
tmp_str
.
ptr
(),
tmp_str
.
length
(),
cs
);
}
table
->
field
[
10
]
->
set_notnull
();
...
...
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