diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2020-04-02 20:48:38 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2020-04-02 20:48:38 +0300 |
commit | 0932c5804d720e1e1ee1d632ad424883dddfeea0 (patch) | |
tree | 163e10765c02d78f94e37776a38c5c06679d1c52 /mysql-test/main/multi_update.result | |
parent | ba34f409ad104471d1f642a86bf192f1d9c3537d (diff) | |
download | mariadb-git-0932c5804d720e1e1ee1d632ad424883dddfeea0.tar.gz |
MDEV-20515 multi-update tries to position updated table by null reference
Cause
Join tmp table inserts null row because of OUTER JOIN, that's
expected. Since `multi_update::prepare2()` converted
`Item_temptable_rowid` into `Item_field` (28dbdf3)
`multi_update::send_data()` accesses join tmp record directly and
treats it as a normal row ignoring null status of ref field. NULL ref
field is then treated as normal in `multi_update::do_updates()` which
tries to position updated table by reference 0.
Note that reference 0 may be valid reference and the first row of
table can be wrongly updated (see multi_update.test).
Fix
Do not add row into multi-update tmp table in case of null ref
field. Join tmp table does not have null_row status at this time (as
well as `STATUS_NULL_ROW`) and cannot be skipped by these properties
(see first comment in multi_update::send_data()). But it has all null
fields (including the ref field).
Diffstat (limited to 'mysql-test/main/multi_update.result')
-rw-r--r-- | mysql-test/main/multi_update.result | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result index 9d59244dd8b..b3edeb77c44 100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@ -1081,3 +1081,20 @@ b c 2 0 drop view v1; drop table t0, t1,t2; +# +# MDEV-20515 multi-update tries to position updated table by null reference +# +create or replace table t1 (a int); +insert into t1 values (0), (2); +create or replace table t2 (b int); +insert into t2 values (1), (2); +select * from t1 left join t2 on a = b order by b; +a b +0 NULL +2 2 +update t1 left join t2 on a = b set b= 3 order by b; +select * from t2; +b +1 +3 +drop tables t1, t2; |