[MCOL-674] Update a column with a subquery resulted NULLs in the target column Created: 2017-04-20 Updated: 2017-07-13 Resolved: 2017-07-13 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | DMLProc |
| Affects Version/s: | 1.0.8, 1.1.0 |
| Fix Version/s: | 1.0.10 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Daniel Lee (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Sprint: | 2017-14 |
| Description |
|
Build tested: 1.0.8-1 and develop branch Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mytest]> create table t1 (c1 int, c2 char(5)) engine=columnstore; MariaDB [mytest]> create table t2 (c1 int, c2 char(5)) engine=columnstore; MariaDB [mytest]> insert into t1 values (5, 'aa'); MariaDB [mytest]> insert into t1 values (5, 'aa'); MariaDB [mytest]> insert into t1 values (5, 'aa'); MariaDB [mytest]> insert into t1 values (5, 'aa'); MariaDB [mytest]> insert into t1 values (5, 'aa'); MariaDB [mytest]> insert into t2 values (1, 'aa'); MariaDB [mytest]> insert into t2 values (1, 'aa'); MariaDB [mytest]> insert into t2 values (1, 'aa'); MariaDB [mytest]> insert into t2 values (1, 'aa'); MariaDB [mytest]> insert into t2 values (1, 'aa'); MariaDB [mytest]> select * from t1;
-----
----- MariaDB [mytest]> select * from t2;
-----
----- MariaDB [mytest]> update t1 set t1.c1=(select distinct c1 from t2); MariaDB [mytest]> select * from t1;
-----
----- MariaDB [mytest]> update t1 set c1=5; MariaDB [mytest]> select * from t1;
-----
----- MariaDB [mytest]> update t1 set t1.c1=(select c1 from t2 limit 1); MariaDB [mytest]> show warnings;
------
------ MariaDB [mytest]> select * from t1;
-----
----- MariaDB [mytest]> |
| Comments |
| Comment by Daniel Lee (Inactive) [ 2017-04-20 ] | ||||||||
|
the same issue occurs when distinct and limit 1 is not used. Could it be update with a subquery instead? MariaDB [mytest]> update text1 t1 set t1.c1=(select c1 from text2); MariaDB [mytest]> select c1 from text1;
------
------ MariaDB [mytest]> select c1 from text2;
------
------ | ||||||||
| Comment by Daniel Lee (Inactive) [ 2017-04-20 ] | ||||||||
|
update using table join worked: update text1 t1, text2 t2 set t1.c1+10=t2.c1 where t1.c1 = t2.c1; | ||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-07-11 ] | ||||||||
|
Pull request for 1.0 and 1.1. | ||||||||
| Comment by Daniel Lee (Inactive) [ 2017-07-13 ] | ||||||||
|
Build verified: Github source 1.0.10 [root@localhost mariadb-columnstore-server]# git show [root@localhost mariadb-columnstore-engine]# git show |