Skip to content
Closed
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
28 changes: 26 additions & 2 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12170,7 +12170,13 @@ impl<'a> Parser<'a> {
self.expect_token(&Token::RParen)?;
Ok(DataType::FixedString(character_length))
}
Keyword::TEXT => Ok(DataType::Text),
Keyword::TEXT => match self.parse_optional_type_modifiers()? {
Some(modifiers) => Ok(DataType::Custom(
ObjectName::from(vec![Ident::new("TEXT")]),
modifiers,
)),
None => Ok(DataType::Text),
},
Keyword::TINYTEXT => Ok(DataType::TinyText),
Keyword::MEDIUMTEXT => Ok(DataType::MediumText),
Keyword::LONGTEXT => Ok(DataType::LongText),
Expand Down Expand Up @@ -20200,7 +20206,7 @@ mod tests {
use crate::ast::{
CharLengthUnits, CharacterLength, DataType, ExactNumberInfo, ObjectName, TimezoneInfo,
};
use crate::dialect::{AnsiDialect, GenericDialect, PostgreSqlDialect};
use crate::dialect::{AnsiDialect, GenericDialect, PostgreSqlDialect, SnowflakeDialect};
use crate::test_utils::TestedDialects;

macro_rules! test_parse_data_type {
Expand Down Expand Up @@ -20403,6 +20409,24 @@ mod tests {
);
}

#[test]
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Remove this test

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

I addressed this feedback in c6b2605.

Summary: Created commit c6b2605e on the existing branch. The only code change in this turn was removing the remaining Snowflake-specific regression test from tests/sqlparser_snowflake.rs, leaving the generic parser fix and synthetic coverage already present in src/parser/mod.rs#L12173 and src/parser/mod.rs#L20413. Checklist against review feedback: - `1. Remove this condition...

fn test_parse_text_with_length_as_custom_type() {
let dialect = TestedDialects::new(vec![
Box::new(GenericDialect {}),
Box::new(PostgreSqlDialect {}),
Box::new(SnowflakeDialect {}),
]);

test_parse_data_type!(
dialect,
"TEXT(16777216)",
DataType::Custom(
ObjectName::from(vec!["TEXT".into()]),
vec!["16777216".to_string()]
)
);
}

#[test]
fn test_ansii_exact_numeric_types() {
// Exact numeric types: <https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type>
Expand Down
Loading