[MDEV-2842] LP:938518 - HAVING does not reject the result of aggregation Created: 2012-02-22  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: Igor Babaev Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: Launchpad

Attachments: XML File LPexportBug938518.xml    

 Description   

Using mariadb-5.2 create and populate table 1 with the following commands:

CREATE TABLE t1 (pk INT PRIMARY KEY, a INT);
INSERT INTO t1 VALUES (2,7), (4,7), (6,2), (17,0);

Execute the following queries:
SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1;
SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1 HAVING MIN(t.pk) < 10;

The first query return the right result while the second query returns a wrong result:

MariaDB [test]> SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1;
-----------

MIN(t.pk)

-----------

NULL

-----------

MariaDB [test]> SELECT MIN(t.pk) FROM t1, t1 as t WHERE t1.pk = 1 HAVING MIN(t.pk) < 10;
-----------

MIN(t.pk)

-----------

NULL

-----------



 Comments   
Comment by Rasmus Johansson (Inactive) [ 2012-02-25 ]

Launchpad bug id: 938518

Generated at Thu Feb 08 06:44:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.