SGA-13064: Query parsing failed due to casting to text(n)#3
SGA-13064: Query parsing failed due to casting to text(n)#3
Conversation
src/parser/mod.rs
Outdated
| } | ||
| Keyword::TEXT => Ok(DataType::Text), | ||
| Keyword::TEXT => { | ||
| if dialect_is!(dialect is SnowflakeDialect) { |
There was a problem hiding this comment.
Remove this condition, this code can run on all dialects
There was a problem hiding this comment.
I addressed this feedback in 90a4ac6.
Summary: Committed the follow-up as 90a4ac6efd021f279cf4fcad8f102977f4cd8165 on the current branch. Checklist: - [x] Feedback 1: removed the Snowflake-only condition so TEXT(<modifiers>) is handled for all dialects in src/parser/mod.rs. - [x] Feedback 2: renamed the remaining Snowflake cast regression test to test_parse_cast_to_text_with_length in tests/sqlparser_snowflake.rs. - [x] Feedback 3: removed the extra unit test the review calle...
tests/sqlparser_snowflake.rs
Outdated
| } | ||
|
|
||
| #[test] | ||
| fn test_parse_pg_style_cast_to_text_with_length() { |
There was a problem hiding this comment.
Rename to test_parse_cast_to_text_with_length
There was a problem hiding this comment.
I addressed this feedback in 90a4ac6.
Summary: Committed the follow-up as 90a4ac6efd021f279cf4fcad8f102977f4cd8165 on the current branch. Checklist: - [x] Feedback 1: removed the Snowflake-only condition so TEXT(<modifiers>) is handled for all dialects in src/parser/mod.rs. - [x] Feedback 2: renamed the remaining Snowflake cast regression test to test_parse_cast_to_text_with_length in tests/sqlparser_snowflake.rs. - [x] Feedback 3: removed the extra unit test the review calle...
tests/sqlparser_snowflake.rs
Outdated
| } | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
I addressed this feedback in 90a4ac6.
Summary: Committed the follow-up as 90a4ac6efd021f279cf4fcad8f102977f4cd8165 on the current branch. Checklist: - [x] Feedback 1: removed the Snowflake-only condition so TEXT(<modifiers>) is handled for all dialects in src/parser/mod.rs. - [x] Feedback 2: renamed the remaining Snowflake cast regression test to test_parse_cast_to_text_with_length in tests/sqlparser_snowflake.rs. - [x] Feedback 3: removed the extra unit test the review calle...
| ); | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
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...
Jira issue: SGA-13064
Prepared by agent-sqlparser-coder.
The fix is committed as
36572d42with messageHandle Snowflake TEXT cast modifiers.Root cause was the
TEXTbranch insrc/parser/mod.rs:12173: Snowflake::TEXT(16777216)hitKeyword::TEXT => DataType::Text, which consumedTEXTbut left(16777216)unparsed. I changed that branch so SnowflakeTEXT(...)parses its modifiers and preserves them asDataType::Custom("TEXT", ...), while plainTEXTbehavior stays unchanged.I added focused Snowflake regressions in
tests/sqlparser_snowflake.rs:5015andtests/sqlparser_snowflake.rs:5043covering bothexpr::TEXT(n)andCAST(expr AS TEXT(n)).Validation passed:
cargo fmt --allcargo test --all-featurescargo clippy --all-targets --all-features -- -D warningscargo doc --document-private-items --no-deps --workspace --all-featuresThe branch is clean and ready to push.