Bug #34614 Foreign Keys: syntax error with double reference
Submitted: 15 Feb 2008 23:27 Modified: 22 Feb 2008 11:50
Reporter: Peter Gulutzan Email Updates:
Status: Closed
Category:Server: Parser Severity:S3 (Non-critical)
Version:6.1.0-fk-debug OS:Linux (SUSE 10 | 32-bit)
Assigned to: Dmitry Lenev Target Version:6.1.0
Triage: D2 (Serious)

[15 Feb 2008 23:27] Peter Gulutzan
Description:
I'm using mysql-6.1-fk, a new foreign-key tree.
There is no need to verify.

I put two REFERENCES column constraints in the
same column definition. I get a syntax error.

This is only a complaint about "syntax error",
as a test of recent parser changes.

How to repeat:
mysql> CREATE table a (s1 INT REFERENCES b REFERENCES c);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'REFERENCES c)'
at line 1

Suggested fix:
This test comes from one of the examples in my 2008-02-12 email
"Designing & Implementing test coverage for Foreign keys".

Please re-read the email "WL#148 Changes" in dev-private archive
https://intranet.mysql.com/secure/mailarchive/mail.php?folder=4&mail=21958
[16 Feb 2008 8:26] 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/commits/42417

ChangeSet@1.2549, 2008-02-16 11:26:10+03:00, dlenev@mockturtle.local +3 -0
  Tentative fix for bug #34614 "Foreign Keys: syntax error with double reference".
  
  According to the standard there can be several column foreign key constraints
  defined for the same column but our grammar does not allow this.
  
  This patch fixes grammar to support such constructs. Note that column foreign
  key constraints are still ignored after parsing.
  
  QQ: What about UNIQUE/NOT NULL/PRIMARY specifications? According to the
      standard they are column constraints too and therefore can be
      intermixed with referential constraints...
[21 Feb 2008 18:16] Konstantin Osipov
Sent a code review by email.
[21 Feb 2008 20:09] 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/commits/42785

ChangeSet@1.2549, 2008-02-21 23:09:27+03:00, dlenev@mockturtle.local +3 -0
  Fix for bug #34614 "Foreign Keys: syntax error with double reference".
  
  According to the standard there can be several column foreign key constraints
  defined for the same column but our grammar does not allow this.
  
  This patch fixes grammar to support such constructs. Note that column foreign
  key constraints are still ignored after parsing.
[22 Feb 2008 5:30] 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/commits/42800

ChangeSet@1.2549, 2008-02-22 08:30:11+03:00, dlenev@mockturtle.local +3 -0
  Fix for bug #34614 "Foreign Keys: syntax error with double reference".
  
  According to the standard there can be several column foreign key constraints
  defined for the same column but our grammar does not allow this.
  
  This patch fixes grammar to support such constructs. Note that column foreign
  key constraints are still ignored after parsing.
[22 Feb 2008 11:50] Dmitry Lenev
Since this bug is reported against and relevant for the tree which is not public I am
moving this bug directly to "Closed".