Fix strict Fabric/TSQL validation for PostgreSQL dates and subqueries - #396
Fix strict Fabric/TSQL validation for PostgreSQL dates and subqueries#396VaibhaveS wants to merge 2 commits into
Conversation
|
Thanks for putting this together. The intended I found one additional cast edge that seems worth addressing before merge. For example: SELECT to_date('0001-01-01'::char(1), 'YYYY-MM-DD'::text)The PR build currently accepts this in strict mode for both targets and emits: SELECT CONVERT(DATE, CAST('0001-01-01' AS CHAR(1)), 23)PostgreSQL reduces the first argument to A focused adjustment could either:
It would also be helpful to add a bounded The rest of the patch looked good in review. |
|
Addressed in I chose the cast-semantics option: The mirrored Fabric and T-SQL tests now:
Validation after the change:
|
|
Thanks for the update—the earlier cast-semantics concern is addressed thoroughly. The reported While stress-checking the updated helper, I noticed one resource-use edge worth addressing before merge. result.extend(std::iter::repeat_n(
' ',
length.saturating_sub(value_length),
));The cast parser currently stores the parsed length through an SELECT to_date('1'::char(-1), 'YYYY-MM-DD')
SELECT to_date('1'::char(4294967295), 'YYYY-MM-DD')If either reaches strict PostgreSQL-to-T-SQL/Fabric generation, the one-character literal can cause an attempted allocation of roughly 4 GiB of padding before the date-range check runs. Large valid widths also create work proportional to the declared width even though the range checker immediately trims the padding. A focused adjustment could keep the effective truncated prefix without physically constructing trailing spaces, since those spaces do not affect this year-domain check. Alternatively, validating or safely bounding the width before allocation would avoid the proportional allocation. A regression covering a very large or negative declared width would help ensure this path remains controlled. Everything else in the update looks good. Formatting and diff checks pass, both focused suites pass (Fabric 150/150 and T-SQL 149/149), and the complete GitHub CI run is green across quality, Rust, Python, SDK, and Go. |
Summary
TO_DATEliterals against the T-SQL/FabricDATEdomainFixes #393
Fixes #395
Validation
cargo fmt --all --checkfabric_regression: 150 passedtsql_regression: 149 passedThe broader all-dialects crate command was also attempted locally, but the filesystem ran out of space while linking unrelated test binaries; the two complete affected target suites finished successfully.