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
9f3b53fb
Commit
9f3b53fb
authored
Dec 14, 2015
by
Oleksandr Byelkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-9093 Persistent computed column is not updated when update query contains join
added lost virtual fields update call
parent
a3d843d9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
0 deletions
+85
-0
mysql-test/suite/vcol/inc/vcol_ins_upd.inc
mysql-test/suite/vcol/inc/vcol_ins_upd.inc
+27
-0
mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result
mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result
+26
-0
mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result
mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result
+26
-0
sql/sql_update.cc
sql/sql_update.cc
+6
-0
No files found.
mysql-test/suite/vcol/inc/vcol_ins_upd.inc
View file @
9f3b53fb
...
...
@@ -287,3 +287,30 @@ select * from t1;
set
sql_warnings
=
0
;
drop
table
t1
;
--
echo
#
--
echo
# MDEV-9093: Persistent computed column is not updated when
--
echo
# update query contains join
--
echo
#
CREATE
TABLE
`t1`
(
`id`
bigint
(
20
)
NOT
NULL
,
`name`
varchar
(
254
)
DEFAULT
NULL
,
`name_hash`
varchar
(
64
)
AS
(
sha1
(
name
))
PERSISTENT
,
PRIMARY
KEY
(
`id`
)
);
insert
into
t1
(
id
,
name
)
values
(
2050
,
'name1'
),(
2051
,
'name2'
),(
2041
,
'name3'
);
create
table
t2
(
id
bigint
);
insert
into
t2
values
(
2050
),(
2051
),(
2041
);
select
*
from
t1
;
update
t1
join
t2
using
(
id
)
set
name
=
concat
(
name
,
'+1'
)
where
t1
.
id
in
(
2051
,
2041
);
select
*
from
t1
;
drop
table
t1
,
t2
;
mysql-test/suite/vcol/r/vcol_ins_upd_innodb.result
View file @
9f3b53fb
...
...
@@ -425,3 +425,29 @@ select * from t1;
a b c d
set sql_warnings = 0;
drop table t1;
#
# MDEV-9093: Persistent computed column is not updated when
# update query contains join
#
CREATE TABLE `t1` (
`id` bigint(20) NOT NULL,
`name` varchar(254) DEFAULT NULL,
`name_hash` varchar(64) AS (sha1(name)) PERSISTENT,
PRIMARY KEY (`id`)
);
insert into t1(id,name) values (2050, 'name1'),(2051, 'name2'),(2041, 'name3');
create table t2 (id bigint);
insert into t2 values (2050),(2051),(2041);
select * from t1;
id name name_hash
2041 name3 1aefcd1b0f39da45fa1fd7236f683c907c15ef82
2050 name1 9b46b0dd3a8083c070c3b9953bb5f3f95c5ab4da
2051 name2 39ea84acf1fef629fef18a9c6f5799bba32ecc25
update t1 join t2 using(id) set name = concat(name,
'+1') where t1.id in (2051,2041);
select * from t1;
id name name_hash
2041 name3+1 93c9096df48221428de46e146abc9f4f94bf7d2e
2050 name1 9b46b0dd3a8083c070c3b9953bb5f3f95c5ab4da
2051 name2+1 fd4f236320db3956a5ec073c5ec39707d7f05708
drop table t1,t2;
mysql-test/suite/vcol/r/vcol_ins_upd_myisam.result
View file @
9f3b53fb
...
...
@@ -363,3 +363,29 @@ select * from t1;
a b c d
set sql_warnings = 0;
drop table t1;
#
# MDEV-9093: Persistent computed column is not updated when
# update query contains join
#
CREATE TABLE `t1` (
`id` bigint(20) NOT NULL,
`name` varchar(254) DEFAULT NULL,
`name_hash` varchar(64) AS (sha1(name)) PERSISTENT,
PRIMARY KEY (`id`)
);
insert into t1(id,name) values (2050, 'name1'),(2051, 'name2'),(2041, 'name3');
create table t2 (id bigint);
insert into t2 values (2050),(2051),(2041);
select * from t1;
id name name_hash
2050 name1 9b46b0dd3a8083c070c3b9953bb5f3f95c5ab4da
2051 name2 39ea84acf1fef629fef18a9c6f5799bba32ecc25
2041 name3 1aefcd1b0f39da45fa1fd7236f683c907c15ef82
update t1 join t2 using(id) set name = concat(name,
'+1') where t1.id in (2051,2041);
select * from t1;
id name name_hash
2050 name1 9b46b0dd3a8083c070c3b9953bb5f3f95c5ab4da
2051 name2+1 fd4f236320db3956a5ec073c5ec39707d7f05708
2041 name3+1 93c9096df48221428de46e146abc9f4f94bf7d2e
drop table t1,t2;
sql/sql_update.cc
View file @
9f3b53fb
...
...
@@ -2234,6 +2234,12 @@ int multi_update::do_updates()
if
(
!
can_compare_record
||
compare_record
(
table
))
{
int
error
;
if
(
table
->
vfield
&&
update_virtual_fields
(
thd
,
table
,
(
table
->
triggers
?
VCOL_UPDATE_ALL
:
VCOL_UPDATE_FOR_WRITE
)))
goto
err2
;
if
((
error
=
cur_table
->
view_check_option
(
thd
,
ignore
))
!=
VIEW_CHECK_OK
)
{
...
...
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