Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/dialect/postgresql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,18 @@ pub fn parse_comment(parser: &mut Parser) -> Result<Statement, ParserError> {
}

pub fn parse_create(parser: &mut Parser) -> Option<Result<Statement, ParserError>> {
let name = parser.maybe_parse(|parser| -> Result<ObjectName, ParserError> {
if let Ok(name) = parser.maybe_parse(|parser| -> Result<ObjectName, ParserError> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah should this rather return the error? since the error would be a recursion error, so that the return type fot parse_create becomes Result<Option<Result<statement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, updated in the next commit

parser.expect_keyword(Keyword::CREATE)?;
parser.expect_keyword(Keyword::TYPE)?;
let name = parser.parse_object_name(false)?;
parser.expect_keyword(Keyword::AS)?;
parser.expect_keyword(Keyword::ENUM)?;
Ok(name)
});
name.map(|name| parse_create_type_as_enum(parser, name))
}) {
return name.map(|name| parse_create_type_as_enum(parser, name));
}

None
}

// https://www.postgresql.org/docs/current/sql-createtype.html
Expand Down