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:
pawel.leszczynski 2023-03-09 14:06:39 +01:00 committed by GitHub
parent 548191814c
commit 4ff3aeb040
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View file

@ -49,6 +49,8 @@ impl Dialect for PostgreSqlDialect {
}
pub fn parse_comment(parser: &mut Parser) -> Result<Statement, ParserError> {
let if_exists = parser.parse_keywords(&[Keyword::IF, Keyword::EXISTS]);
parser.expect_keyword(Keyword::ON)?;
let token = parser.next_token();
@ -74,5 +76,6 @@ pub fn parse_comment(parser: &mut Parser) -> Result<Statement, ParserError> {
object_type,
object_name,
comment,
if_exists,
})
}