Skip to content

fix: Move global cast to string length limit of 3000 to Db2 specific code path#1658

Open
nj1973 wants to merge 6 commits intodevelopfrom
1634-db2-cast-string-technical-debt
Open

fix: Move global cast to string length limit of 3000 to Db2 specific code path#1658
nj1973 wants to merge 6 commits intodevelopfrom
1634-db2-cast-string-technical-debt

Conversation

@nj1973
Copy link
Collaborator

@nj1973 nj1973 commented Jan 27, 2026

Description of changes

This PR changes how we currently define the target data type for a CAST to string in Db2.

Db2 has a conservative approach to estimating string lengths, assuming the worst case/longest possible length. At some point during initial Db2 implementation a change was implemented to apply a length of 3000 to all casts to string. While it was intended for this to be Db2 specific the change was actually global and active across other engines. I saw it active during Sybase and Oracle testing.

This PR does not change the limit of 3000 on Db2 but modifies the location of the change to be Db2 specific. This comes with a risk though... what if by fixing one problem we create a new one in another engine that we didn't know was benefiting from the same code?

I've run all tests and they pass, I think that's all I can realistically do. But we should be prepared for subsequent changes if customer notice a negative impact.

In summary, there should be no functional change from this PR, we are only removing unintentional side effects.

Issues to be closed

Closes #1634

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 linked an issue Jan 27, 2026 that may be closed by this pull request
@nj1973 nj1973 marked this pull request as ready for review January 29, 2026 10:46
@nj1973
Copy link
Collaborator Author

nj1973 commented Feb 3, 2026

/gcbrun

@nj1973 nj1973 requested a review from cofin February 4, 2026 09:17
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.

Db2 implementation technical debt

1 participant