[MDEV-2760] LP:612894 - Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value Created: 2010-08-03 Updated: 2015-02-02 Resolved: 2012-10-04 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major |
| Reporter: | Philip Stoev (Inactive) | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | Launchpad | ||
| Attachments: |
|
| Description |
|
The following query SELECT table1 .`col_varchar_nokey` Returns 1 extra row when executed with subquery cache, as compared to execution with no subquery cache, maria-5.2 or mysql 5.5.5-m3. |
| Comments |
| Comment by Philip Stoev (Inactive) [ 2010-08-03 ] |
|
Re: Subquery cache returns extra rows on query with view CREATE TABLE `B` ( INSERT INTO `B` VALUES (1,1,7,'1900-01-01','1900-01-01','01:13:38','01:13:38','2005-02-05 00:00:00','2005-02-05 00:00:00','p','p'); CREATE VIEW view_B AS SELECT * FROM B; CREATE TABLE `CC` ( SET SESSION optimizer_switch = 'subquery_cache=off'; /* cache is ON */ SELECT COUNT /* cache is OFF */ SELECT COUNT |
| Comment by Philip Stoev (Inactive) [ 2010-08-03 ] |
|
Re: Subquery cache returns extra rows on query with nested joins CREATE TABLE `CC` ( SET SESSION optimizer_switch = 'subquery_cache=off'; /* cache is OFF */ SELECT ( SET SESSION optimizer_switch = 'subquery_cache=on'; /* cache is ON */ SELECT ( |
| Comment by Oleksandr Byelkin [ 2010-08-11 ] |
|
Re: Subquery cache returns extra rows on query with nested joins SET SESSION optimizer_switch = 'subquery_cache=off'; |
| Comment by Oleksandr Byelkin [ 2010-08-11 ] |
|
Re: Subquery cache returns extra rows on query with nested joins |
| Comment by Philip Stoev (Inactive) [ 2010-08-11 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value SELECT ( SELECT table1 .`col_int_nokey`, ( |
| Comment by Philip Stoev (Inactive) [ 2010-08-11 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value |
| Comment by Oleksandr Byelkin [ 2010-08-11 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value The problem is in not reset null_value... |
| Comment by Oleksandr Byelkin [ 2010-08-11 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value |
| Comment by Oleksandr Byelkin [ 2010-08-13 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value SELECT t1.col_int_nokey, (select max(t2.col_int_key2) from t2 where t1.col_int_nokey) from t1; works correctly with min/max optimisation in opt_sum.cc. It do not works for outer join which alwats return result. Also the problem visible without subqueries, lets take impossible where with random function in it (which should return NULL but retuirn 0): the way to solve the problem I see in the fact that such MAX/MIN has only two possible results: |
| Comment by Oleksandr Byelkin [ 2010-08-20 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value SELECT t1.col_int_nokey, (select max(t2.col_int_key2) from t2 where drop table t1, t2; |
| Comment by Oleksandr Byelkin [ 2010-08-20 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value SELECT table1 .`col_int_nokey`,( SELECT MIN( SUBQUERY1_t1 .`col_int_key` ) select rand()*0 != 0; drop table t1, t2; |
| Comment by Michael Widenius [ 2010-08-21 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value CREATE TABLE t1 (a int(11) NOT NULL); select min(t2.key_col) from t1,t2 where t1.a=1; The last query should return NULL |
| Comment by Philip Stoev (Inactive) [ 2010-08-25 ] |
|
Re: Some aggregate functions (such as MIN MAX) work incorrectly in subqueries after getting NULL value |
| Comment by Rasmus Johansson (Inactive) [ 2011-12-13 ] |
|
Launchpad bug id: 612894 |