Skip to content

fix: Cast SQL Server len() expression to BIGINT#1590

Merged
nj1973 merged 4 commits into
developfrom
1589-sql-server-sum-strlen-int-overflow
Sep 22, 2025
Merged

fix: Cast SQL Server len() expression to BIGINT#1590
nj1973 merged 4 commits into
developfrom
1589-sql-server-sum-strlen-int-overflow

Conversation

@nj1973

@nj1973 nj1973 commented Sep 17, 2025

Copy link
Copy Markdown
Collaborator

Description of changes

Casts SQL Server len/datalength expressions to bigint to prevent column validations on large tables from overflowing the int data type.

Issues to be closed

Closes #1589

Checklist

  • I have followed the CONTRIBUTING Guide.
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated any relevant documentation to reflect my changes, if applicable
  • I have added unit and/or integration tests relevant to my change as needed
  • I have already checked locally that all unit tests and linting are passing (use the tests/local_check.sh script)
  • I have manually executed end-to-end testing (E2E) with the affected databases/engines

@nj1973

nj1973 commented Sep 17, 2025

Copy link
Copy Markdown
Collaborator Author

/gcbrun

@helensilva14 helensilva14 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@sundar-mudupalli-work

Copy link
Copy Markdown
Collaborator

Neil,

This resolves the issue of string lengths adding up over the size of the integer. However, even int32 columns have the same issue. It may be best to focus on the issues raised by customers - so we know we are fixing things that need to be fixed.

Thank you.

Sundar Mudupalli

@nj1973 nj1973 merged commit b0dfe13 into develop Sep 22, 2025
5 checks passed
@nj1973 nj1973 deleted the 1589-sql-server-sum-strlen-int-overflow branch September 22, 2025 08:51
@nj1973

nj1973 commented Sep 22, 2025

Copy link
Copy Markdown
Collaborator Author

Neil,

This resolves the issue of string lengths adding up over the size of the integer. However, even int32 columns have the same issue. It may be best to focus on the issues raised by customers - so we know we are fixing things that need to be fixed.

Thank you.

Sundar Mudupalli

This was raised by a customer, but directly to me and I created the issue on their behalf.

The same customer did raise the "int32 columns" issue with me (#1584) but I realised we already had an option to cater for it so closed it. I think we should automate the option in the future because it is unnecessary but I haven't created an issue for that (yet).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SQL Server column validation exception for sum of string lengths when int overflows

3 participants