Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13902,6 +13902,9 @@ impl<'a> Parser<'a> {
fn parse_structured_object_type_def(&mut self) -> Result<Vec<ColumnDef>, ParserError> {
self.expect_token(&Token::LParen)?;
let fields = self.parse_comma_separated(|parser| {
if matches!(parser.peek_token_ref().token, Token::SingleQuotedString(_)) {
return parser.expected("an object field identifier", parser.peek_token());
}
let name = parser.parse_identifier()?;
let data_type = parser.parse_data_type()?;
let options = if parser.parse_keywords(&[Keyword::NOT, Keyword::NULL]) {
Expand Down
2 changes: 2 additions & 0 deletions tests/sqlparser_snowflake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5561,6 +5561,8 @@ fn test_structured_object_type() {
fn test_structured_object_type_errors() {
for sql in [
"CREATE TABLE t (o OBJECT(VARCHAR))",
"CREATE TABLE t (o OBJECT('json'))",
"CREATE TABLE t (o OBJECT('city' VARCHAR))",
"CREATE TABLE t (o OBJECT(city VARCHAR NULL))",
"CREATE TABLE t (o OBJECT(city VARCHAR)",
] {
Expand Down
Loading