You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Ignore inline REFERENCES clauses to match MySQL #564
MySQL accepts but ignores inline REFERENCES clauses. Our CREATE TABLE handling turns them into enforced foreign keys, so inserts that work in MySQL can fail with this driver.
Reproduction
CREATETABLEp (id INTPRIMARY KEY);
CREATETABLEt (id INT, a INTREFERENCES p (id));
INSERT INTO t (a) VALUES (999);
Expected: The insert succeeds. MySQL 8.4 ignores the inline reference and records no foreign-key constraint.
Actual: The insert fails with FOREIGN KEY constraint failed. The driver also creates foreign-key entries in KEY_COLUMN_USAGE and REFERENTIAL_CONSTRAINTS.
The equivalent single-column ALTER TABLE ADD and parenthesized ADD forms already ignore the inline clause and match MySQL.
Required behavior
Ignore inline REFERENCES during CREATE TABLE, including its foreign-key metadata.
Keep the same behavior across both ALTER TABLE ADD forms.
Preserve support for explicit table-level FOREIGN KEY (a) REFERENCES p (id) constraints.
Add regression coverage for the accepted insert and absent foreign-key metadata, alongside an explicit foreign-key constraint that still rejects the insert.
The MySQL documentation describes this distinction. Both the insert behavior and metadata difference were reproduced against MySQL 8.4.
Found while reviewing #557. These behaviors predate that PR and are separate from its parenthesized-list fix.
Activity
[-]Ignore inline REFERENCES clauses to match MySQL[/-][+]Ignore inline `REFERENCES` clauses to match MySQL[/+]