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
1b608b0b
Commit
1b608b0b
authored
Mar 01, 2014
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-5735 Selecting from SEQUENCE table with negative number hangs server
parent
04de6ccc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
storage/sequence/mysql-test/sequence/simple.result
storage/sequence/mysql-test/sequence/simple.result
+4
-0
storage/sequence/mysql-test/sequence/simple.test
storage/sequence/mysql-test/sequence/simple.test
+8
-0
storage/sequence/sequence.cc
storage/sequence/sequence.cc
+10
-4
No files found.
storage/sequence/mysql-test/sequence/simple.result
View file @
1b608b0b
...
...
@@ -40,6 +40,10 @@ show create table se;
ERROR 42S02: Table 'test.se' doesn't exist
show create table seq_1_to_15_step_0;
ERROR HY000: Got error 140 "Wrong create options" from storage engine SEQUENCE
show create table `seq_-1_to_15`;
ERROR 42S02: Table 'test.seq_-1_to_15' doesn't exist
show create table `seq_1_to_+2`;
ERROR 42S02: Table 'test.seq_1_to_+2' doesn't exist
select * from seq_1_to_15_step_2;
seq
1
...
...
storage/sequence/mysql-test/sequence/simple.test
View file @
1b608b0b
...
...
@@ -26,6 +26,14 @@ show create table se;
--
error
ER_GET_ERRNO
show
create
table
seq_1_to_15_step_0
;
#
# MDEV-5735 Selecting from SEQUENCE table with negative number hangs server
#
--
error
ER_NO_SUCH_TABLE
show
create
table
`seq_-1_to_15`
;
--
error
ER_NO_SUCH_TABLE
show
create
table
`seq_1_to_+2`
;
# simple select
select
*
from
seq_1_to_15_step_2
;
select
*
from
seq_1_to_15
;
...
...
storage/sequence/sequence.cc
View file @
1b608b0b
...
...
@@ -20,6 +20,7 @@
a engine that auto-creates tables with rows filled with sequential values
*/
#include <ctype.h>
#include <mysql_version.h>
#include <handler.h>
#include <table.h>
...
...
@@ -265,14 +266,19 @@ static handler *create_handler(handlerton *hton, TABLE_SHARE *table,
static
bool
parse_table_name
(
const
char
*
name
,
size_t
name_length
,
ulonglong
*
from
,
ulonglong
*
to
,
ulonglong
*
step
)
{
uint
n1
=
0
,
n2
=
0
;
uint
n
0
=
0
,
n
1
=
0
,
n2
=
0
;
*
step
=
1
;
// the table is discovered if its name matches the pattern of seq_1_to_10 or
// seq_1_to_10_step_3
sscanf
(
name
,
"seq_%llu_to_%llu%n_step_%llu%n"
,
from
,
to
,
&
n1
,
step
,
&
n2
);
return
n1
!=
name_length
&&
n2
!=
name_length
;
sscanf
(
name
,
"seq_%llu_to_%n%llu%n_step_%llu%n"
,
from
,
&
n0
,
to
,
&
n1
,
step
,
&
n2
);
// I consider this a bug in sscanf() - when an unsigned number
// is requested, -5 should *not* be accepted. But is is :(
// hence the additional check below:
return
n0
==
0
||
!
isdigit
(
name
[
4
])
||
!
isdigit
(
name
[
n0
])
||
// reject negative numbers
(
n1
!=
name_length
&&
n2
!=
name_length
);
}
...
...
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