[MDEV-5015] Wrong result with an aggregate function, index and impossible condition inside OR Created: 2013-09-15  Updated: 2013-09-16  Resolved: 2013-09-16

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5.33
Fix Version/s: 5.5.33a, 5.3.13

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 Description   

The wrong result started appearing on 5.3 tree since the following revision:

revno: 3676 [merge]
revision-id: igor@askmonty.org-20130815235920-io2h7tlypwlbunsp
parent: igor@askmonty.org-20130815210420-l2lr4dhln2li77iy
parent: igor@askmonty.org-20130815211616-80di8in2ae5fttxd
committer: Igor Babaev <igor@askmonty.org>
branch nick: maria-5.3
timestamp: Thu 2013-08-15 16:59:20 -0700
message:
  Merge
    ------------------------------------------------------------
    revno: 3669.1.1
    revision-id: igor@askmonty.org-20130815211616-80di8in2ae5fttxd
    parent: bar@mariadb.org-20130709070256-0evtbj6foe8za239
    committer: Igor Babaev <igor@askmonty.org>
    branch nick: maria-5.3-bugs
    timestamp: Thu 2013-08-15 14:16:16 -0700
    message:
      Fixed bug mdev-4355.
      This patch almost totally revised the patch for bug mdev-4177.
      The latter had too many defects. In particular, it did not
      propagate multiple equalities formed when merging a degenerate
      disjunct into underlying AND formula.

Test case:

CREATE TABLE t1 (i1 INT, INDEX(i1));
INSERT INTO t1 VALUES (9),(8);
 
CREATE TABLE t2 (i2 INT);
INSERT INTO t2 VALUES (8),(4);
 
SELECT MAX( t1a.i1 ) FROM t1 AS t1a, t2, t1 AS t1b WHERE t1b.i1 = i2 AND ( 0 OR t1a.i1 = i2 );

Actual result:

MAX( t1a.i1 )
9

Expected result:

MAX( t1a.i1 )
8



 Comments   
Comment by Igor Babaev [ 2013-09-16 ]

The fix for the bug was pushed into the 5.3 tree and merged into the 5.5 tree

Generated at Thu Feb 08 07:01:00 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.