Add support of COMMENT ON syntax for Snowflake (#1516)

This commit is contained in:
hulk 2024-11-13 21:23:33 +08:00 committed by GitHub
parent 76322baf2f
commit 6d907d3adc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 164 additions and 102 deletions

View file

@ -2891,68 +2891,6 @@ fn test_composite_value() {
);
}
#[test]
fn parse_comments() {
match pg().verified_stmt("COMMENT ON COLUMN tab.name IS 'comment'") {
Statement::Comment {
object_type,
object_name,
comment: Some(comment),
if_exists,
} => {
assert_eq!("comment", comment);
assert_eq!("tab.name", object_name.to_string());
assert_eq!(CommentObject::Column, object_type);
assert!(!if_exists);
}
_ => unreachable!(),
}
match pg().verified_stmt("COMMENT ON EXTENSION plpgsql IS 'comment'") {
Statement::Comment {
object_type,
object_name,
comment: Some(comment),
if_exists,
} => {
assert_eq!("comment", comment);
assert_eq!("plpgsql", object_name.to_string());
assert_eq!(CommentObject::Extension, object_type);
assert!(!if_exists);
}
_ => unreachable!(),
}
match pg().verified_stmt("COMMENT ON TABLE public.tab IS 'comment'") {
Statement::Comment {
object_type,
object_name,
comment: Some(comment),
if_exists,
} => {
assert_eq!("comment", comment);
assert_eq!("public.tab", object_name.to_string());
assert_eq!(CommentObject::Table, object_type);
assert!(!if_exists);
}
_ => unreachable!(),
}
match pg().verified_stmt("COMMENT IF EXISTS ON TABLE public.tab IS NULL") {
Statement::Comment {
object_type,
object_name,
comment: None,
if_exists,
} => {
assert_eq!("public.tab", object_name.to_string());
assert_eq!(CommentObject::Table, object_type);
assert!(if_exists);
}
_ => unreachable!(),
}
}
#[test]
fn parse_quoted_identifier() {
pg_and_generic().verified_stmt(r#"SELECT "quoted "" ident""#);