mirror of
https://github.com/apache/datafusion-sqlparser-rs.git
synced 2025-07-09 18:04:59 +00:00
support IF EXISTS in COMMENT statements (#831)
* support IF EXISTS in COMMENT statements Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> * Update src/ast/mod.rs Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org> --------- Signed-off-by: Pawel Leszczynski <leszczynski.pawel@gmail.com> Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
This commit is contained in:
parent
548191814c
commit
4ff3aeb040
3 changed files with 19 additions and 2 deletions
|
@ -1790,10 +1790,12 @@ fn parse_comments() {
|
|||
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!(),
|
||||
}
|
||||
|
@ -1803,22 +1805,26 @@ fn parse_comments() {
|
|||
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 ON TABLE public.tab IS NULL") {
|
||||
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!(),
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue