Skip to content

Commit 2008030

Browse files
Snowflake: parse NCHAR [VARYING] as a data type
NCHAR fell through to the generic Custom-type fallback, so NCHAR VARYING parsed as Custom(NCHAR) with VARYING swallowed as a column alias, and NCHAR VARYING(n) failed to parse. Add a dedicated NCHAR arm: VARYING yields Nvarchar (the varying-length form), bare NCHAR keeps the existing Custom(NCHAR) representation.
1 parent 6d7f5cf commit 2008030

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/parser/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13070,6 +13070,17 @@ impl<'a> Parser<'a> {
1307013070
Keyword::NVARCHAR => {
1307113071
Ok(DataType::Nvarchar(self.parse_optional_character_length()?))
1307213072
}
13073+
Keyword::NCHAR => {
13074+
if self.parse_keyword(Keyword::VARYING) {
13075+
Ok(DataType::Nvarchar(self.parse_optional_character_length()?))
13076+
} else {
13077+
let modifiers = self.parse_optional_type_modifiers()?.unwrap_or_default();
13078+
Ok(DataType::Custom(
13079+
ObjectName::from(vec![Ident::new("NCHAR")]),
13080+
modifiers,
13081+
))
13082+
}
13083+
}
1307313084
Keyword::CHARACTER => {
1307413085
if self.parse_keyword(Keyword::VARYING) {
1307513086
Ok(DataType::CharacterVarying(

0 commit comments

Comments
 (0)