Bug #10586 query works with 4.1.8, but not with 4.1.11
Submitted: 12 May 2005 11:08 Modified: 5 Oct 2005 14:13
Reporter: Hartmut Holzgraefe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.11 OS:Linux (linux)
Assigned to: Antony Curtis CPU Architecture:Any

[12 May 2005 11:08] Hartmut Holzgraefe
Description:

query works with 4.1.8, but not with 4.1.11

How to repeat:
CREATE TABLE IF NOT EXISTS T1
(	ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
	DATA VARCHAR(5) NOT NULL,

	PRIMARY KEY (ID)
) ENGINE=INNODB;

CREATE TABLE IF NOT EXISTS T2
(	ID INT UNSIGNED NOT NULL AUTO_INCREMENT,
	DATA VARCHAR(5) NOT NULL,
	FID INT UNSIGNED NOT NULL,

	PRIMARY KEY (ID),
	FOREIGN KEY (FID)
		REFERENCES T1 (ID)
		ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=INNODB;

# works
SELECT A.* FROM (T1 inner join (SELECT * FROM T2) AS A on T1.ID = A.FID);

# works with 4.1.7-nt-max
# throws an SQL parse error with 4.1.11-nt-max
SELECT T2.* FROM ((SELECT * FROM T1) AS A inner join T2 on A.ID = T2.FID);

# works
SELECT T2.* FROM (SELECT * FROM T1) AS A inner join T2 on A.ID = T2.FID;

----

Version 4.1.11 parses the query correctly if the paretheses around the from
clause are removed.
[5 Jun 2005 4:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/25613
[7 Sep 2005 11:09] Konstantin Osipov
Antony, Brian
as no easy fix for the bug exists in 4.1, and in current circumstances, my proposal is to not fix it in 4.1, but make sure that the behaviour is correct in 5.0 and add the test case to the test suite.
[7 Sep 2005 15:39] Brian Aker
Antony, go on and fix this in 5.0.
[7 Sep 2005 16:10] Antony Curtis
This bug does not exist in 5.x - the rejected patch for 4.1 was derived from the current grammar in 5.0.
[7 Sep 2005 16:39] Konstantin Osipov
Antony, please commit a test case for this bug to 5.0 unless it's not there yet.
[8 Sep 2005 17:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/29515
[15 Sep 2005 14:43] Konstantin Osipov
The patch is OK to push, but I think the test case should be moved after 'end of 4.1 tests' marker.
[5 Oct 2005 14:13] Antony Curtis
Test case pushed to 5.0