@@ -12170,20 +12170,13 @@ impl<'a> Parser<'a> {
1217012170 self.expect_token(&Token::RParen)?;
1217112171 Ok(DataType::FixedString(character_length))
1217212172 }
12173- Keyword::TEXT => {
12174- if dialect_is!(dialect is SnowflakeDialect) {
12175- if let Some(modifiers) = self.parse_optional_type_modifiers()? {
12176- Ok(DataType::Custom(
12177- ObjectName::from(vec![Ident::new("TEXT")]),
12178- modifiers,
12179- ))
12180- } else {
12181- Ok(DataType::Text)
12182- }
12183- } else {
12184- Ok(DataType::Text)
12185- }
12186- }
12173+ Keyword::TEXT => match self.parse_optional_type_modifiers()? {
12174+ Some(modifiers) => Ok(DataType::Custom(
12175+ ObjectName::from(vec![Ident::new("TEXT")]),
12176+ modifiers,
12177+ )),
12178+ None => Ok(DataType::Text),
12179+ },
1218712180 Keyword::TINYTEXT => Ok(DataType::TinyText),
1218812181 Keyword::MEDIUMTEXT => Ok(DataType::MediumText),
1218912182 Keyword::LONGTEXT => Ok(DataType::LongText),
@@ -20213,7 +20206,7 @@ mod tests {
2021320206 use crate::ast::{
2021420207 CharLengthUnits, CharacterLength, DataType, ExactNumberInfo, ObjectName, TimezoneInfo,
2021520208 };
20216- use crate::dialect::{AnsiDialect, GenericDialect, PostgreSqlDialect};
20209+ use crate::dialect::{AnsiDialect, GenericDialect, PostgreSqlDialect, SnowflakeDialect };
2021720210 use crate::test_utils::TestedDialects;
2021820211
2021920212 macro_rules! test_parse_data_type {
@@ -20416,6 +20409,24 @@ mod tests {
2041620409 );
2041720410 }
2041820411
20412+ #[test]
20413+ fn test_parse_text_with_length_as_custom_type() {
20414+ let dialect = TestedDialects::new(vec![
20415+ Box::new(GenericDialect {}),
20416+ Box::new(PostgreSqlDialect {}),
20417+ Box::new(SnowflakeDialect {}),
20418+ ]);
20419+
20420+ test_parse_data_type!(
20421+ dialect,
20422+ "TEXT(16777216)",
20423+ DataType::Custom(
20424+ ObjectName::from(vec!["TEXT".into()]),
20425+ vec!["16777216".to_string()]
20426+ )
20427+ );
20428+ }
20429+
2041920430 #[test]
2042020431 fn test_ansii_exact_numeric_types() {
2042120432 // Exact numeric types: <https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type>
0 commit comments