Skip Menu |

This queue is for tickets about the SQL-Translator CPAN distribution.

Report information
The Basics
Id: 7395
Status: new
Priority: 0/
Queue: SQL-Translator

Owner: Nobody in particular
Requestors: dhoworth [...]

Bug Information
Severity: Wishlist
Broken in: 0.05
Fixed in: (no value)

Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
MIME-Version: 1.0
X-Mailer: MIME-tools 5.411 (Entity 5.404)
Subject: MySQL parser doesn't support ALTER TABLE ADD FOREIGN KEY
X-RT-Original-Encoding: iso-8859-1
Content-Length: 546
Download (untitled) / with headers
text/plain 546b
AFAIK, the only way to add a foreign key referencing a table that's not created yet is to ALTER the referring table after the referenced table is created. The creation order cannot be swapped if there is an inverse foreign key. CREATE TABLE a ( id INT, b_id INT, PRIMARY KEY (id), INDEX (b_id) ); CREATE TABLE b ( id INT, a_id INT, PRIMARY KEY (id), INDEX (a_id), FOREIGN KEY (a_id) REFERENCES a (id) ); ALTER TABLE a ADD FOREIGN KEY (b_id) REFERENCES b (id); It would be nice if the parser could handle this case. Thanks, Dave

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to