This is an automated email from the ASF dual-hosted git repository.

iffyio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 40b187f3 Snowflake: Numeric prefix for stage name part (#1966)
40b187f3 is described below

commit 40b187f32a4bc4b8a5fddd5c9cedc96c6c66b5af
Author: Yoav Cohen <[email protected]>
AuthorDate: Wed Jul 23 19:44:00 2025 +0300

    Snowflake: Numeric prefix for stage name part (#1966)
---
 src/dialect/snowflake.rs     | 1 +
 tests/sqlparser_snowflake.rs | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/dialect/snowflake.rs b/src/dialect/snowflake.rs
index 9786aba0..26432b3f 100644
--- a/src/dialect/snowflake.rs
+++ b/src/dialect/snowflake.rs
@@ -841,6 +841,7 @@ pub fn parse_stage_name_identifier(parser: &mut Parser) -> 
Result<Ident, ParserE
             Token::Mod => ident.push('%'),
             Token::Div => ident.push('/'),
             Token::Plus => ident.push('+'),
+            Token::Number(n, _) => ident.push_str(n),
             Token::Word(w) => ident.push_str(&w.to_string()),
             _ => return parser.expected("stage name identifier", 
parser.peek_token()),
         }
diff --git a/tests/sqlparser_snowflake.rs b/tests/sqlparser_snowflake.rs
index daa711d4..7edb0d06 100644
--- a/tests/sqlparser_snowflake.rs
+++ b/tests/sqlparser_snowflake.rs
@@ -2628,7 +2628,7 @@ fn test_snowflake_copy_into() {
     }
 
     // Test for non-ident characters in stage names
-    let sql = "COPY INTO a.b FROM @namespace.stage_name/x@x~x%x+";
+    let sql = "COPY INTO a.b FROM 
@namespace.stage_name/x@x~x%x+/20250723_data";
     assert_eq!(snowflake().verified_stmt(sql).to_string(), sql);
     match snowflake().verified_stmt(sql) {
         Statement::CopyIntoSnowflake { into, from_obj, .. } => {
@@ -2640,7 +2640,7 @@ fn test_snowflake_copy_into() {
                 from_obj,
                 Some(ObjectName::from(vec![
                     Ident::new("@namespace"),
-                    Ident::new("stage_name/x@x~x%x+")
+                    Ident::new("stage_name/x@x~x%x+/20250723_data")
                 ]))
             )
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to