Adds support for mysql's drop index (#1864)

Co-authored-by: Ifeanyi Ubah <ify1992@yahoo.com>
This commit is contained in:
Dmitriy Mazurin 2025-05-30 08:16:36 +01:00 committed by GitHub
parent a8bde39efb
commit 80d47eee84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 58 additions and 11 deletions

View file

@ -3405,6 +3405,9 @@ pub enum Statement {
purge: bool,
/// MySQL-specific "TEMPORARY" keyword
temporary: bool,
/// MySQL-specific drop index syntax, which requires table specification
/// See <https://dev.mysql.com/doc/refman/8.4/en/drop-index.html>
table: Option<ObjectName>,
},
/// ```sql
/// DROP FUNCTION
@ -5242,17 +5245,24 @@ impl fmt::Display for Statement {
restrict,
purge,
temporary,
} => write!(
f,
"DROP {}{}{} {}{}{}{}",
if *temporary { "TEMPORARY " } else { "" },
object_type,
if *if_exists { " IF EXISTS" } else { "" },
display_comma_separated(names),
if *cascade { " CASCADE" } else { "" },
if *restrict { " RESTRICT" } else { "" },
if *purge { " PURGE" } else { "" }
),
table,
} => {
write!(
f,
"DROP {}{}{} {}{}{}{}",
if *temporary { "TEMPORARY " } else { "" },
object_type,
if *if_exists { " IF EXISTS" } else { "" },
display_comma_separated(names),
if *cascade { " CASCADE" } else { "" },
if *restrict { " RESTRICT" } else { "" },
if *purge { " PURGE" } else { "" },
)?;
if let Some(table_name) = table.as_ref() {
write!(f, " ON {}", table_name)?;
};
Ok(())
}
Statement::DropFunction {
if_exists,
func_desc,