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
e3f6ea50
Commit
e3f6ea50
authored
Feb 18, 2019
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge 10.1 into 10.2
parents
3a42926c
98e185ee
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
58 additions
and
64 deletions
+58
-64
mysql-test/suite/innodb/r/foreign_key.result
mysql-test/suite/innodb/r/foreign_key.result
+13
-0
mysql-test/suite/innodb/t/foreign_key.test
mysql-test/suite/innodb/t/foreign_key.test
+11
-0
storage/innobase/dict/dict0dict.cc
storage/innobase/dict/dict0dict.cc
+17
-32
storage/xtradb/dict/dict0dict.cc
storage/xtradb/dict/dict0dict.cc
+17
-32
No files found.
mysql-test/suite/innodb/r/foreign_key.result
View file @
e3f6ea50
...
...
@@ -249,6 +249,19 @@ Warnings:
Warning 1088 failed to load FOREIGN KEY constraints
ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
DROP TABLE t1;
#
# MDEV-18630 Conditional jump or move depends on uninitialised value
# in ib_push_warning / dict_create_foreign_constraints_low
#
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
ALTER IGNORE TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (b);
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
SHOW WARNINGS;
Level Code Message
Warning 150 Alter table test/#sql-temporary with foreign key constraint failed. Referenced table `test`.`t2` not found in the data dictionary near 'FOREIGN KEY (a) REFERENCES t2 (b)'.
Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint
DROP TABLE t1;
# Start of 10.2 tests
#
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
...
...
mysql-test/suite/innodb/t/foreign_key.test
View file @
e3f6ea50
...
...
@@ -230,6 +230,17 @@ ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f);
ALTER
TABLE
t1
ADD
FULLTEXT
INDEX
ft2
(
f
);
DROP
TABLE
t1
;
--
echo
#
--
echo
# MDEV-18630 Conditional jump or move depends on uninitialised value
--
echo
# in ib_push_warning / dict_create_foreign_constraints_low
--
echo
#
CREATE
TABLE
t1
(
a
INT
)
ENGINE
=
InnoDB
;
--
error
ER_CANT_CREATE_TABLE
ALTER
IGNORE
TABLE
t1
ADD
FOREIGN
KEY
(
a
)
REFERENCES
t2
(
b
);
--
replace_regex
/
#sql-[0-9_a-f-]*/#sql-temporary/
SHOW
WARNINGS
;
DROP
TABLE
t1
;
--
echo
# Start of 10.2 tests
--
echo
#
...
...
storage/innobase/dict/dict0dict.cc
View file @
e3f6ea50
...
...
@@ -4386,7 +4386,6 @@ dict_create_foreign_constraints_low(
const
char
*
create_table_name
;
const
char
*
orig
;
char
create_name
[
MAX_TABLE_NAME_LEN
+
1
];
char
operation
[
8
];
ut_ad
(
!
srv_read_only_mode
);
ut_ad
(
mutex_own
(
&
dict_sys
->
mutex
));
...
...
@@ -4397,41 +4396,33 @@ dict_create_foreign_constraints_low(
orig
=
ptr
;
ptr
=
dict_accept
(
cs
,
ptr
,
"ALTER"
,
&
success
);
strcpy
((
char
*
)
operation
,
success
?
"Alter "
:
"Create "
)
;
const
char
*
const
operation
=
success
?
"Alter "
:
"Create "
;
if
(
!
success
)
{
orig
=
ptr
;
ptr
=
dict_scan_to
(
ptr
,
"CREATE"
);
ptr
=
dict_scan_to
(
ptr
,
"TABLE"
);
ptr
=
dict_accept
(
cs
,
ptr
,
"TABLE"
,
&
success
);
create_table_name
=
NULL
;
if
(
success
)
{
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_create
,
name
,
&
success
,
heap
,
&
create_table_name
);
&
success
,
heap
,
&
create_table_name
);
}
if
(
success
)
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
create_table_name
,
strlen
(
create_table_name
),
trx
->
mysql_thd
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
ptr
=
orig
;
}
else
{
char
*
bufend
;
ptr
=
orig
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
name
,
strlen
(
name
),
trx
->
mysql_thd
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
goto
loop
;
ptr
=
orig
;
const
char
*
n
=
create_table_name
?
create_table_name
:
name
;
char
*
bufend
=
innobase_convert_name
(
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
trx
->
mysql_thd
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
strncpy
(
create_name
,
name
,
sizeof
create_name
);
create_name
[(
sizeof
create_name
)
-
1
]
=
'\0'
;
}
if
(
table
==
NULL
)
{
mutex_enter
(
&
dict_foreign_err_mutex
);
dict_foreign_error_report_low
(
ef
,
create_name
);
dict_foreign_error_report_low
(
ef
,
create_name
);
fprintf
(
ef
,
"%s table %s with foreign key constraint"
" failed. Table %s not found from data dictionary."
" Error close to %s.
\n
"
,
...
...
@@ -4466,19 +4457,13 @@ dict_create_foreign_constraints_low(
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_alter
,
name
,
&
success
,
heap
,
&
referenced_table_name
);
if
(
table_to_alter
)
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
table_to_alter
->
name
.
m_name
,
strlen
(
table_to_alter
->
name
.
m_name
),
trx
->
mysql_thd
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
referenced_table_name
,
strlen
(
referenced_table_name
),
trx
->
mysql_thd
);
{
const
char
*
n
=
table_to_alter
?
table_to_alter
->
name
.
m_name
:
referenced_table_name
;
char
*
bufend
=
innobase_convert_name
(
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
trx
->
mysql_thd
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
if
(
!
success
)
{
...
...
storage/xtradb/dict/dict0dict.cc
View file @
e3f6ea50
...
...
@@ -4405,7 +4405,6 @@ dict_create_foreign_constraints_low(
const
char
*
create_table_name
;
const
char
*
orig
;
char
create_name
[
MAX_TABLE_NAME_LEN
+
1
];
char
operation
[
8
];
ut_ad
(
!
srv_read_only_mode
);
ut_ad
(
mutex_own
(
&
(
dict_sys
->
mutex
)));
...
...
@@ -4416,41 +4415,33 @@ dict_create_foreign_constraints_low(
orig
=
ptr
;
ptr
=
dict_accept
(
cs
,
ptr
,
"ALTER"
,
&
success
);
strcpy
((
char
*
)
operation
,
success
?
"Alter "
:
"Create "
)
;
const
char
*
const
operation
=
success
?
"Alter "
:
"Create "
;
if
(
!
success
)
{
orig
=
ptr
;
ptr
=
dict_scan_to
(
ptr
,
"CREATE"
);
ptr
=
dict_scan_to
(
ptr
,
"TABLE"
);
ptr
=
dict_accept
(
cs
,
ptr
,
"TABLE"
,
&
success
);
create_table_name
=
NULL
;
if
(
success
)
{
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_create
,
name
,
&
success
,
heap
,
&
create_table_name
);
&
success
,
heap
,
&
create_table_name
);
}
if
(
success
)
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
create_table_name
,
strlen
(
create_table_name
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
ptr
=
orig
;
}
else
{
char
*
bufend
;
ptr
=
orig
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
name
,
strlen
(
name
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
goto
loop
;
ptr
=
orig
;
const
char
*
n
=
create_table_name
?
create_table_name
:
name
;
char
*
bufend
=
innobase_convert_name
(
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
strncpy
(
create_name
,
name
,
sizeof
create_name
);
create_name
[(
sizeof
create_name
)
-
1
]
=
'\0'
;
}
if
(
table
==
NULL
)
{
mutex_enter
(
&
dict_foreign_err_mutex
);
dict_foreign_error_report_low
(
ef
,
create_name
);
dict_foreign_error_report_low
(
ef
,
create_name
);
fprintf
(
ef
,
"%s table %s with foreign key constraint"
" failed. Table %s not found from data dictionary."
" Error close to %s.
\n
"
,
...
...
@@ -4485,19 +4476,13 @@ dict_create_foreign_constraints_low(
ptr
=
dict_scan_table_name
(
cs
,
ptr
,
&
table_to_alter
,
name
,
&
success
,
heap
,
&
referenced_table_name
);
if
(
table_to_alter
)
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
table_to_alter
->
name
,
strlen
(
table_to_alter
->
name
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
else
{
char
*
bufend
;
bufend
=
innobase_convert_name
((
char
*
)
create_name
,
MAX_TABLE_NAME_LEN
,
referenced_table_name
,
strlen
(
referenced_table_name
),
trx
->
mysql_thd
,
TRUE
);
{
const
char
*
n
=
table_to_alter
?
table_to_alter
->
name
:
referenced_table_name
;
char
*
bufend
=
innobase_convert_name
(
create_name
,
MAX_TABLE_NAME_LEN
,
n
,
strlen
(
n
),
trx
->
mysql_thd
,
TRUE
);
create_name
[
bufend
-
create_name
]
=
'\0'
;
}
if
(
!
success
)
{
...
...
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