Bug #34615 Foreign Keys: Syntax error with alter and references
Submitted: 15 Feb 2008 23:30 Modified: 22 Feb 2008 11:49
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
Triage: D2 (Serious)

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

I say ALTER TABLE to change a column definition
which includes a REFERENCES clause. I get a syntax error.

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

How to repeat:
mysql> ALTER TABLE t2 MODIFY COLUMN s1 INT REFERENCES t1 (s1);
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 t1
(s1)' at line 1
[22 Feb 2008 7:54] 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/42801

ChangeSet@1.2551, 2008-02-22 10:54:12+03:00, dlenev@mockturtle.local +3 -0
  Fix for bug #34615 "Foreign Keys: Syntax error with alter and references".
  
  According to WL148 ALTER TABLE should support addition of referential
  constraints in CHANGE COLUMN and MODIFY COLUMN clauses. Support for
  such constructs was omitted from the patch which implemented 1st
  milestone of this worklog (implementing grammar changes).
  
  This patch adjusts grammar to enable such support. Note that column
  foreign key constraints are still ignored after parsing.
[22 Feb 2008 11:49] 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".