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
84575fe0
Commit
84575fe0
authored
Apr 10, 2006
by
mikael@c-4908e253.1238-1-64736c10.cust.bredbandsbolaget.se
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#18750: Various problems with partition names, quotation marks
parent
ba5d08f3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
3 deletions
+79
-3
mysql-test/r/partition.result
mysql-test/r/partition.result
+17
-0
mysql-test/t/partition.test
mysql-test/t/partition.test
+24
-0
sql/partition_info.cc
sql/partition_info.cc
+12
-0
sql/share/errmsg.txt
sql/share/errmsg.txt
+3
-0
sql/sql_partition.cc
sql/sql_partition.cc
+17
-2
sql/sql_show.cc
sql/sql_show.cc
+5
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+1
-1
No files found.
mysql-test/r/partition.result
View file @
84575fe0
...
@@ -839,4 +839,21 @@ SHOW TABLE STATUS;
...
@@ -839,4 +839,21 @@ SHOW TABLE STATUS;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t1 MyISAM 10 Dynamic 0 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
t1 MyISAM 10 Dynamic 0 0 0 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
DROP TABLE t1;
DROP TABLE t1;
create table t1 (a int)
partition by list (a)
(partition `s1 s2` values in (0));
drop table t1;
create table t1 (a int)
partition by list (a)
(partition `7` values in (0));
drop table t1;
create table t1 (a int)
partition by list (a)
(partition `s1 s2 ` values in (0));
ERROR HY000: Incorrect partition name
create table t1 (a int)
partition by list (a)
subpartition by hash (a)
(partition p1 values in (0) (subpartition `p1 p2 `));
ERROR HY000: Incorrect partition name
End of 5.1 tests
End of 5.1 tests
mysql-test/t/partition.test
View file @
84575fe0
...
@@ -956,4 +956,28 @@ PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM);
...
@@ -956,4 +956,28 @@ PARTITION p2 VALUES LESS THAN (30) ENGINE = MyISAM);
SHOW
TABLE
STATUS
;
SHOW
TABLE
STATUS
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
#
#BUG 18750 Problems with partition names
#
create
table
t1
(
a
int
)
partition
by
list
(
a
)
(
partition
`s1 s2`
values
in
(
0
));
drop
table
t1
;
create
table
t1
(
a
int
)
partition
by
list
(
a
)
(
partition
`7`
values
in
(
0
));
drop
table
t1
;
--
error
ER_WRONG_PARTITION_NAME
create
table
t1
(
a
int
)
partition
by
list
(
a
)
(
partition
`s1 s2 `
values
in
(
0
));
--
error
ER_WRONG_PARTITION_NAME
create
table
t1
(
a
int
)
partition
by
list
(
a
)
subpartition
by
hash
(
a
)
(
partition
p1
values
in
(
0
)
(
subpartition
`p1 p2 `
));
--
echo
End
of
5.1
tests
--
echo
End
of
5.1
tests
sql/partition_info.cc
View file @
84575fe0
...
@@ -696,6 +696,12 @@ bool partition_info::check_partition_info(handlerton **eng_type,
...
@@ -696,6 +696,12 @@ bool partition_info::check_partition_info(handlerton **eng_type,
partition_element
*
part_elem
=
part_it
++
;
partition_element
*
part_elem
=
part_it
++
;
if
(
!
is_sub_partitioned
())
if
(
!
is_sub_partitioned
())
{
{
if
(
check_table_name
(
part_elem
->
partition_name
,
strlen
(
part_elem
->
partition_name
)))
{
my_error
(
ER_WRONG_PARTITION_NAME
,
MYF
(
0
));
goto
end
;
}
if
(
part_elem
->
engine_type
==
NULL
)
if
(
part_elem
->
engine_type
==
NULL
)
part_elem
->
engine_type
=
default_engine_type
;
part_elem
->
engine_type
=
default_engine_type
;
DBUG_PRINT
(
"info"
,
(
"engine = %d"
,
DBUG_PRINT
(
"info"
,
(
"engine = %d"
,
...
@@ -709,6 +715,12 @@ bool partition_info::check_partition_info(handlerton **eng_type,
...
@@ -709,6 +715,12 @@ bool partition_info::check_partition_info(handlerton **eng_type,
do
do
{
{
part_elem
=
sub_it
++
;
part_elem
=
sub_it
++
;
if
(
check_table_name
(
part_elem
->
partition_name
,
strlen
(
part_elem
->
partition_name
)))
{
my_error
(
ER_WRONG_PARTITION_NAME
,
MYF
(
0
));
goto
end
;
}
if
(
part_elem
->
engine_type
==
NULL
)
if
(
part_elem
->
engine_type
==
NULL
)
part_elem
->
engine_type
=
default_engine_type
;
part_elem
->
engine_type
=
default_engine_type
;
DBUG_PRINT
(
"info"
,
(
"engine = %u"
,
DBUG_PRINT
(
"info"
,
(
"engine = %u"
,
...
...
sql/share/errmsg.txt
View file @
84575fe0
...
@@ -5826,3 +5826,6 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT
...
@@ -5826,3 +5826,6 @@ ER_NDB_CANT_SWITCH_BINLOG_FORMAT
eng "The NDB cluster engine does not support changing the binlog format on the fly yet"
eng "The NDB cluster engine does not support changing the binlog format on the fly yet"
ER_PARTITION_NO_TEMPORARY
ER_PARTITION_NO_TEMPORARY
eng "Cannot create temporary table with partitions"
eng "Cannot create temporary table with partitions"
ER_WRONG_PARTITION_NAME
eng "Incorrect partition name"
swe "Felaktigt partitionsnamn"
sql/sql_partition.cc
View file @
84575fe0
...
@@ -1614,6 +1614,21 @@ static int add_key_partition(File fptr, List<char> field_list)
...
@@ -1614,6 +1614,21 @@ static int add_key_partition(File fptr, List<char> field_list)
return
err
;
return
err
;
}
}
static
int
add_name_string
(
File
fptr
,
const
char
*
name
)
{
int
err
;
String
name_string
(
""
,
0
,
system_charset_info
);
THD
*
thd
=
current_thd
;
ulonglong
save_options
=
thd
->
options
;
thd
->
options
=
0
;
append_identifier
(
thd
,
&
name_string
,
name
,
strlen
(
name
));
thd
->
options
=
save_options
;
err
=
add_string_object
(
fptr
,
&
name_string
);
return
err
;
}
static
int
add_int
(
File
fptr
,
longlong
number
)
static
int
add_int
(
File
fptr
,
longlong
number
)
{
{
llstr
(
number
,
buff
);
llstr
(
number
,
buff
);
...
@@ -1912,7 +1927,7 @@ char *generate_partition_syntax(partition_info *part_info,
...
@@ -1912,7 +1927,7 @@ char *generate_partition_syntax(partition_info *part_info,
part_info
->
part_state_len
=
part_state_id
+
1
;
part_info
->
part_state_len
=
part_state_id
+
1
;
}
}
err
+=
add_partition
(
fptr
);
err
+=
add_partition
(
fptr
);
err
+=
add_string
(
fptr
,
part_elem
->
partition_name
);
err
+=
add_
name_
string
(
fptr
,
part_elem
->
partition_name
);
err
+=
add_space
(
fptr
);
err
+=
add_space
(
fptr
);
err
+=
add_partition_values
(
fptr
,
part_info
,
part_elem
);
err
+=
add_partition_values
(
fptr
,
part_info
,
part_elem
);
if
(
!
part_info
->
is_sub_partitioned
())
if
(
!
part_info
->
is_sub_partitioned
())
...
@@ -1928,7 +1943,7 @@ char *generate_partition_syntax(partition_info *part_info,
...
@@ -1928,7 +1943,7 @@ char *generate_partition_syntax(partition_info *part_info,
{
{
part_elem
=
sub_it
++
;
part_elem
=
sub_it
++
;
err
+=
add_subpartition
(
fptr
);
err
+=
add_subpartition
(
fptr
);
err
+=
add_string
(
fptr
,
part_elem
->
partition_name
);
err
+=
add_
name_
string
(
fptr
,
part_elem
->
partition_name
);
err
+=
add_space
(
fptr
);
err
+=
add_space
(
fptr
);
err
+=
add_partition_options
(
fptr
,
part_elem
);
err
+=
add_partition_options
(
fptr
,
part_elem
);
if
(
j
!=
(
no_subparts
-
1
))
if
(
j
!=
(
no_subparts
-
1
))
...
...
sql/sql_show.cc
View file @
84575fe0
...
@@ -753,6 +753,7 @@ mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd)
...
@@ -753,6 +753,7 @@ mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd)
static
const
char
*
require_quotes
(
const
char
*
name
,
uint
name_length
)
static
const
char
*
require_quotes
(
const
char
*
name
,
uint
name_length
)
{
{
uint
length
;
uint
length
;
bool
pure_digit
=
TRUE
;
const
char
*
end
=
name
+
name_length
;
const
char
*
end
=
name
+
name_length
;
for
(;
name
<
end
;
name
++
)
for
(;
name
<
end
;
name
++
)
...
@@ -761,7 +762,11 @@ static const char *require_quotes(const char *name, uint name_length)
...
@@ -761,7 +762,11 @@ static const char *require_quotes(const char *name, uint name_length)
length
=
my_mbcharlen
(
system_charset_info
,
chr
);
length
=
my_mbcharlen
(
system_charset_info
,
chr
);
if
(
length
==
1
&&
!
system_charset_info
->
ident_map
[
chr
])
if
(
length
==
1
&&
!
system_charset_info
->
ident_map
[
chr
])
return
name
;
return
name
;
if
(
length
==
1
&&
(
chr
<
'0'
||
chr
>
'9'
))
pure_digit
=
FALSE
;
}
}
if
(
pure_digit
)
return
name
;
return
0
;
return
0
;
}
}
...
...
sql/sql_yacc.yy
View file @
84575fe0
...
@@ -3639,7 +3639,7 @@ part_definition:
...
@@ -3639,7 +3639,7 @@ part_definition:
;
;
part_name:
part_name:
ident
_or_text
ident
{
{
LEX *lex= Lex;
LEX *lex= Lex;
partition_info *part_info= lex->part_info;
partition_info *part_info= lex->part_info;
...
...
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