Bug #3347 syntax error with parenthesis in nested union/select statements
Submitted: 31 Mar 2004 13:34 Modified: 9 Apr 2004 0:57
Reporter: Stan Tomlinson Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.1 OS:Linux (Linux)
Assigned to: Assigned Account CPU Architecture:Any

[31 Mar 2004 13:34] Stan Tomlinson
Description:
I'm not sure if this is a bug, or a request for a feature.

Need to be able to put in parenthesis to indicate grouping of nested union/select statements.

See "how to repeat" for sample SQL statement.
It causes a syntax error.  Don't think it should.

Without paren's, where last union applies is ambiguous.

How to repeat:
select RN from Person
where RN=
  (select distinct Insured from Insurance where RN=
   (select distinct RN from Insurance where Insured=26)
   union
   (select distinct Insurance from Insured where Person=26)
  )
  union
  (select distinct Person from Insured where Insurance=
     (select distinct RN from Insurance where Insured=26)
     union
     (select distinct Insurance from Insured where Person=26)
     )
order by LastName, FirstName;
------------------------------------
Potential other minor related problem:
  select a from b;                  << OK
  (select a from b);                << OK
  ((select a from b));              << syntax error
[31 Mar 2004 15:06] Dean Ellis
Verified against 4.1.2.  Thank you.

(SELECT 1) UNION (SELECT 2);
SELECT 1 IN (SELECT 1 UNION SELECT 2);
SELECT 1 IN ((SELECT 1) UNION (SELECT 2));
[9 Apr 2004 0:57] Oleksandr Byelkin
Thank you for bug report. this bug is registered as BUG#2435 
http://bugs.mysql.com/bug.php?id=2435 
 
You can use that ticket to trace progress of bug fixing.