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
91d75da7
Commit
91d75da7
authored
Jan 09, 2007
by
gluh@mysql.com/eagle.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for bug#25026 `information_schema.KEY_COLUMN_USAGE`.`REFERENCED_TABLE_NAME` returns garbage
Unencode internal db & table name
parent
ae836b42
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
5 deletions
+63
-5
mysql-test/r/information_schema_inno.result
mysql-test/r/information_schema_inno.result
+22
-0
mysql-test/t/information_schema_inno.test
mysql-test/t/information_schema_inno.test
+24
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+17
-5
No files found.
mysql-test/r/information_schema_inno.result
View file @
91d75da7
...
...
@@ -56,3 +56,25 @@ test t3 FOREIGN KEY A2 test t2 NONE SET NULL RESTRICT
test t4 FOREIGN KEY A3 test t3 NONE NO ACTION SET NULL
test t5 FOREIGN KEY A4 test t4 NONE RESTRICT CASCADE
drop tables t5, t4, t3, t2, t1;
create database `db-1`;
use `db-1`;
create table `t-2` (
id int(10) unsigned not null auto_increment,
primary key (id)
) engine=innodb;
create table `t-1` (
id int(10) unsigned not null auto_increment,
idtype int(10) unsigned not null,
primary key (id),
key fk_t1_1 (idtype),
constraint fk_t1_1 foreign key (idtype) references `t-2` (id)
) engine=innodb;
use test;
select referenced_table_schema, referenced_table_name
from information_schema.key_column_usage
where constraint_schema = 'db-1';
referenced_table_schema referenced_table_name
NULL NULL
db-1 t-2
NULL NULL
drop database `db-1`;
mysql-test/t/information_schema_inno.test
View file @
91d75da7
--
source
include
/
testdb_only
.
inc
--
source
include
/
have_innodb
.
inc
--
disable_warnings
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
...
...
@@ -53,3 +54,26 @@ from information_schema.TABLE_CONSTRAINTS a,
where
a
.
CONSTRAINT_SCHEMA
=
'test'
and
a
.
CONSTRAINT_SCHEMA
=
b
.
CONSTRAINT_SCHEMA
and
a
.
CONSTRAINT_NAME
=
b
.
CONSTRAINT_NAME
;
drop
tables
t5
,
t4
,
t3
,
t2
,
t1
;
#
# Bug#25026 `information_schema.KEY_COLUMN_USAGE`.`REFERENCED_TABLE_NAME` returns garbage
#
create
database
`db-1`
;
use
`db-1`
;
create
table
`t-2`
(
id
int
(
10
)
unsigned
not
null
auto_increment
,
primary
key
(
id
)
)
engine
=
innodb
;
create
table
`t-1`
(
id
int
(
10
)
unsigned
not
null
auto_increment
,
idtype
int
(
10
)
unsigned
not
null
,
primary
key
(
id
),
key
fk_t1_1
(
idtype
),
constraint
fk_t1_1
foreign
key
(
idtype
)
references
`t-2`
(
id
)
)
engine
=
innodb
;
use
test
;
select
referenced_table_schema
,
referenced_table_name
from
information_schema
.
key_column_usage
where
constraint_schema
=
'db-1'
;
drop
database
`db-1`
;
storage/innobase/handler/ha_innodb.cc
View file @
91d75da7
...
...
@@ -5933,6 +5933,9 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
uint
i
;
FOREIGN_KEY_INFO
f_key_info
;
LEX_STRING
*
name
=
0
;
uint
ulen
;
char
uname
[
NAME_LEN
*
3
+
1
];
/* Unencoded name */
char
db_name
[
NAME_LEN
*
3
+
1
];
const
char
*
tmp_buff
;
tmp_buff
=
foreign
->
id
;
...
...
@@ -5943,14 +5946,23 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
f_key_info
.
forein_id
=
make_lex_string
(
thd
,
0
,
tmp_buff
,
(
uint
)
strlen
(
tmp_buff
),
1
);
tmp_buff
=
foreign
->
referenced_table_name
;
/* Database name */
i
=
0
;
while
(
tmp_buff
[
i
]
!=
'/'
)
i
++
;
f_key_info
.
referenced_db
=
make_lex_string
(
thd
,
0
,
tmp_buff
,
i
,
1
);
{
db_name
[
i
]
=
tmp_buff
[
i
];
i
++
;
}
db_name
[
i
]
=
0
;
ulen
=
filename_to_tablename
(
db_name
,
uname
,
sizeof
(
uname
));
f_key_info
.
referenced_db
=
make_lex_string
(
thd
,
0
,
uname
,
ulen
,
1
);
/* Table name */
tmp_buff
+=
i
+
1
;
f_key_info
.
referenced_table
=
make_lex_string
(
thd
,
0
,
tmp_buff
,
(
uint
)
strlen
(
tmp_buff
),
1
);
ulen
=
filename_to_tablename
(
tmp_buff
,
uname
,
sizeof
(
uname
));
f_key_info
.
referenced_table
=
make_lex_string
(
thd
,
0
,
uname
,
ulen
,
1
);
for
(
i
=
0
;;)
{
tmp_buff
=
foreign
->
foreign_col_names
[
i
];
...
...
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