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
9838f484
Commit
9838f484
authored
Dec 05, 2010
by
Jimmy Yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Bug #58643 InnoDB: too long table name
rb://531
approved by Sunny Bains
parent
c3adccfd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
15 deletions
+29
-15
storage/innobase/dict/dict0dict.c
storage/innobase/dict/dict0dict.c
+5
-5
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+11
-0
storage/innobase/handler/i_s.cc
storage/innobase/handler/i_s.cc
+1
-10
storage/innobase/include/univ.i
storage/innobase/include/univ.i
+12
-0
No files found.
storage/innobase/dict/dict0dict.c
View file @
9838f484
...
...
@@ -947,7 +947,7 @@ dict_table_rename_in_cache(
dict_foreign_t
*
foreign
;
dict_index_t
*
index
;
ulint
fold
;
char
old_name
[
MAX_
TABLE
_NAME_LEN
+
1
];
char
old_name
[
MAX_
FULL
_NAME_LEN
+
1
];
ut_ad
(
table
);
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
...
...
@@ -959,7 +959,7 @@ dict_table_rename_in_cache(
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
"InnoDB: too long table name: '%s', "
"max length is %d
\n
"
,
table
->
name
,
MAX_
TABLE
_NAME_LEN
);
MAX_
FULL
_NAME_LEN
);
ut_error
;
}
...
...
@@ -1009,11 +1009,11 @@ dict_table_rename_in_cache(
ut_fold_string
(
old_name
),
table
);
if
(
strlen
(
new_name
)
>
strlen
(
table
->
name
))
{
/* We allocate MAX_
TABLE_NAME_LEN+
1 bytes here to avoid
/* We allocate MAX_
FULL_NAME_LEN +
1 bytes here to avoid
memory fragmentation, we assume a repeated calls of
ut_realloc() with the same size do not cause fragmentation */
ut_a
(
strlen
(
new_name
)
<=
MAX_
TABLE
_NAME_LEN
);
table
->
name
=
ut_realloc
(
table
->
name
,
MAX_
TABLE
_NAME_LEN
+
1
);
ut_a
(
strlen
(
new_name
)
<=
MAX_
FULL
_NAME_LEN
);
table
->
name
=
ut_realloc
(
table
->
name
,
MAX_
FULL
_NAME_LEN
+
1
);
}
memcpy
(
table
->
name
,
new_name
,
strlen
(
new_name
)
+
1
);
...
...
storage/innobase/handler/ha_innodb.cc
View file @
9838f484
...
...
@@ -6214,6 +6214,17 @@ create_table_def(
DBUG_RETURN
(
HA_ERR_GENERIC
);
}
/* MySQL does the name length check. But we do additional check
on the name length here */
if
(
strlen
(
table_name
)
>
MAX_FULL_NAME_LEN
)
{
push_warning_printf
(
(
THD
*
)
trx
->
mysql_thd
,
MYSQL_ERROR
::
WARN_LEVEL_WARN
,
ER_TABLE_NAME
,
"InnoDB: Failed to create table %s. Table Name"
" or Database Name is too long"
,
table_name
);
DBUG_RETURN
(
ER_TABLE_NAME
);
}
n_cols
=
form
->
s
->
fields
;
/* We pass 0 as the space id, and determine at a lower level the space
...
...
storage/innobase/handler/i_s.cc
View file @
9838f484
...
...
@@ -759,16 +759,7 @@ fill_innodb_locks_from_cache(
for
(
i
=
0
;
i
<
rows_num
;
i
++
)
{
i_s_locks_row_t
*
row
;
/* note that the decoded database or table name is
never expected to be longer than NAME_LEN;
NAME_LEN for database name
2 for surrounding quotes around database name
NAME_LEN for table name
2 for surrounding quotes around table name
1 for the separating dot (.)
9 for the #mysql50# prefix */
char
buf
[
2
*
NAME_LEN
+
14
];
char
buf
[
MAX_FULL_NAME_LEN
];
const
char
*
bufend
;
char
lock_trx_id
[
TRX_ID_MAX_LEN
+
1
];
...
...
storage/innobase/include/univ.i
View file @
9838f484
...
...
@@ -305,6 +305,18 @@ number does not include a terminating '\0'. InnoDB probably can handle
longer names internally */
#
define
MAX_TABLE_NAME_LEN
192
/* The maximum length of a database name. Like MAX_TABLE_NAME_LEN this is
the MySQL's NAME_LEN, see check_and_convert_db_name(). */
#
define
MAX_DATABASE_NAME_LEN
MAX_TABLE_NAME_LEN
/* MAX_FULL_NAME_LEN defines the full name path including the
database name and table name. In addition, 14 bytes is added for:
2 for surrounding quotes around table name
1 for the separating dot (.)
9 for the #mysql50# prefix */
#
define
MAX_FULL_NAME_LEN
\
(
MAX_TABLE_NAME_LEN
+
MAX_DATABASE_NAME_LEN
+
14
)
/*
UNIVERSAL TYPE DEFINITIONS
==========================
...
...
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