Skip to content

Commit 51ac9a7

Browse files
authoredJan 7, 2025··
Fix(rust-tokenizer): increase integer width when converting hex literals (#4573)
1 parent 0d61fa0 commit 51ac9a7

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

‎sqlglotrs/src/tokenizer.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ impl<'a> TokenizerState<'a> {
458458
let text = self.extract_string(&end, false, token_type == self.token_types.raw_string, true)?;
459459

460460
if let Some(b) = base {
461-
if u64::from_str_radix(&text, b).is_err() {
461+
if u128::from_str_radix(&text, b).is_err() {
462462
return self.error_result(format!(
463463
"Numeric string contains invalid characters from {}:{}",
464464
self.line, self.start

‎tests/dialects/test_snowflake.py

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def test_snowflake(self):
2121
expr.selects[0].assert_is(exp.AggFunc)
2222
self.assertEqual(expr.sql(dialect="snowflake"), "SELECT APPROX_TOP_K(C4, 3, 5) FROM t")
2323

24+
self.validate_identity("INSERT INTO test VALUES (x'48FAF43B0AFCEF9B63EE3A93EE2AC2')")
2425
self.validate_identity("exclude := [foo]")
2526
self.validate_identity("SELECT CAST([1, 2, 3] AS VECTOR(FLOAT, 3))")
2627
self.validate_identity("SELECT CONNECT_BY_ROOT test AS test_column_alias")

0 commit comments

Comments
 (0)
Please sign in to comment.