MySQL: Support index_name in FK constraints (#1871)

This commit is contained in:
Mohamed Abdeen 2025-06-06 08:03:59 +01:00 committed by GitHub
parent 5327f0ce13
commit de2cc7b502
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 7 deletions

View file

@ -3988,6 +3988,13 @@ fn parse_straight_join() {
.verified_stmt("SELECT a.*, b.* FROM table_a STRAIGHT_JOIN table_b AS b ON a.b_id = b.id");
}
#[test]
fn mysql_foreign_key_with_index_name() {
mysql().verified_stmt(
"CREATE TABLE orders (customer_id INT, INDEX idx_customer (customer_id), CONSTRAINT fk_customer FOREIGN KEY idx_customer (customer_id) REFERENCES customers(id))",
);
}
#[test]
fn parse_drop_index() {
let sql = "DROP INDEX idx_name ON table_name";