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
7ef002e9
Commit
7ef002e9
authored
Oct 25, 2011
by
Marko Mäkelä
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql-5.1-security to mysql-5.5-security.
parents
1af865e4
e8d793f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
48 additions
and
12 deletions
+48
-12
mysql-test/suite/innodb/r/innodb.result
mysql-test/suite/innodb/r/innodb.result
+15
-1
mysql-test/suite/innodb/t/innodb.test
mysql-test/suite/innodb/t/innodb.test
+18
-0
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+5
-4
storage/innobase/row/row0ins.c
storage/innobase/row/row0ins.c
+10
-7
No files found.
mysql-test/suite/innodb/r/innodb.result
View file @
7ef002e9
...
...
@@ -1301,6 +1301,20 @@ ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fail
update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
ERROR 42S22: Unknown column 't1.id' in 'where clause'
drop table t3,t2,t1;
CREATE TABLE t1 (
c1 VARCHAR(8), c2 VARCHAR(8),
PRIMARY KEY (c1, c2)
)
ENGINE=InnoDB;
CREATE TABLE t2 (
c0 INT PRIMARY KEY,
c1 VARCHAR(8) UNIQUE,
FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
)
ENGINE=InnoDB;
INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 2 would lead to a duplicate entry
DROP TABLE t2,t1;
create table t1(
id int primary key,
pid int,
...
...
@@ -1673,7 +1687,7 @@ variable_value - @innodb_rows_deleted_orig
71
SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
variable_value - @innodb_rows_inserted_orig
10
66
10
70
SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
variable_value - @innodb_rows_updated_orig
866
...
...
mysql-test/suite/innodb/t/innodb.test
View file @
7ef002e9
...
...
@@ -1046,6 +1046,24 @@ update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id
update
t3
set
t3
.
id
=
7
where
t1
.
id
=
1
and
t2
.
id
=
t1
.
id
and
t3
.
id
=
t2
.
id
;
drop
table
t3
,
t2
,
t1
;
# test ON UPDATE CASCADE
CREATE
TABLE
t1
(
c1
VARCHAR
(
8
),
c2
VARCHAR
(
8
),
PRIMARY
KEY
(
c1
,
c2
)
)
ENGINE
=
InnoDB
;
CREATE
TABLE
t2
(
c0
INT
PRIMARY
KEY
,
c1
VARCHAR
(
8
)
UNIQUE
,
FOREIGN
KEY
(
c1
)
REFERENCES
t1
(
c1
)
ON
UPDATE
CASCADE
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
'old'
,
'somevalu'
),
(
'other'
,
'anyvalue'
);
INSERT
INTO
t2
VALUES
(
10
,
'old'
),
(
20
,
'other'
);
--
error
ER_FOREIGN_DUPLICATE_KEY
UPDATE
t1
SET
c1
=
'other'
WHERE
c1
=
'old'
;
DROP
TABLE
t2
,
t1
;
#
# test for recursion depth limit
#
...
...
storage/innobase/handler/ha_innodb.cc
View file @
7ef002e9
...
...
@@ -5241,14 +5241,15 @@ calc_row_difference(
/* The field has changed */
ufield
=
uvect
->
fields
+
n_changed
;
UNIV_MEM_INVALID
(
ufield
,
sizeof
*
ufield
);
/* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */
dict_col_copy_type
(
prebuilt
->
table
->
cols
+
i
,
dfield_get_type
(
&
dfield
));
if
(
n_len
!=
UNIV_SQL_NULL
)
{
dict_col_copy_type
(
prebuilt
->
table
->
cols
+
i
,
dfield_get_type
(
&
dfield
));
buf
=
row_mysql_store_col_in_innobase_format
(
&
dfield
,
(
byte
*
)
buf
,
...
...
@@ -5256,7 +5257,7 @@ calc_row_difference(
new_mysql_row_col
,
col_pack_len
,
dict_table_is_comp
(
prebuilt
->
table
));
dfield_copy
_data
(
&
ufield
->
new_val
,
&
dfield
);
dfield_copy
(
&
ufield
->
new_val
,
&
dfield
);
}
else
{
dfield_set_null
(
&
ufield
->
new_val
);
}
...
...
storage/innobase/row/row0ins.c
View file @
7ef002e9
...
...
@@ -437,11 +437,9 @@ row_ins_cascade_calc_update_vec(
dict_table_t
*
table
=
foreign
->
foreign_table
;
dict_index_t
*
index
=
foreign
->
foreign_index
;
upd_t
*
update
;
upd_field_t
*
ufield
;
dict_table_t
*
parent_table
;
dict_index_t
*
parent_index
;
upd_t
*
parent_update
;
upd_field_t
*
parent_ufield
;
ulint
n_fields_updated
;
ulint
parent_field_no
;
ulint
i
;
...
...
@@ -477,13 +475,15 @@ row_ins_cascade_calc_update_vec(
dict_index_get_nth_col_no
(
parent_index
,
i
));
for
(
j
=
0
;
j
<
parent_update
->
n_fields
;
j
++
)
{
parent_ufield
=
parent_update
->
fields
+
j
;
const
upd_field_t
*
parent_ufield
=
&
parent_update
->
fields
[
j
];
if
(
parent_ufield
->
field_no
==
parent_field_no
)
{
ulint
min_size
;
const
dict_col_t
*
col
;
ulint
ufield_len
;
upd_field_t
*
ufield
;
col
=
dict_index_get_nth_col
(
index
,
i
);
...
...
@@ -496,6 +496,8 @@ row_ins_cascade_calc_update_vec(
ufield
->
field_no
=
dict_table_get_nth_col_pos
(
table
,
dict_col_get_no
(
col
));
ufield
->
orig_len
=
0
;
ufield
->
exp
=
NULL
;
ufield
->
new_val
=
parent_ufield
->
new_val
;
...
...
@@ -983,10 +985,9 @@ row_ins_foreign_check_on_constraint(
goto
nonstandard_exit_func
;
}
if
((
node
->
is_delete
&&
(
foreign
->
type
&
DICT_FOREIGN_ON_DELETE_SET_NULL
))
||
(
!
node
->
is_delete
&&
(
foreign
->
type
&
DICT_FOREIGN_ON_UPDATE_SET_NULL
)))
{
if
(
node
->
is_delete
?
(
foreign
->
type
&
DICT_FOREIGN_ON_DELETE_SET_NULL
)
:
(
foreign
->
type
&
DICT_FOREIGN_ON_UPDATE_SET_NULL
))
{
/* Build the appropriate update vector which sets
foreign->n_fields first fields in rec to SQL NULL */
...
...
@@ -995,6 +996,8 @@ row_ins_foreign_check_on_constraint(
update
->
info_bits
=
0
;
update
->
n_fields
=
foreign
->
n_fields
;
UNIV_MEM_INVALID
(
update
->
fields
,
update
->
n_fields
*
sizeof
*
update
->
fields
);
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
upd_field_t
*
ufield
=
&
update
->
fields
[
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