Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the incorrect string limit when declaring NVARCHAR(Max) #482

Conversation

chxwang
Copy link
Contributor

@chxwang chxwang commented Nov 24, 2024

Description

Previously, the limit on the max length of NVARCHAR(Max) was 4000, longer characters will be truncated. But NVARCHAR(MAX) should be capable of handling strings far longer than 4,000 characters. This pr change the col_size to default INT_MAX.

Issues Resolved

BABEL-5054

Check List

  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is under the terms of the PostgreSQL license, and grant any person obtaining a copy of the contribution permission to relicense all or a portion of my contribution to the PostgreSQL License solely to contribute all or a portion of my contribution to the PostgreSQL open source project.

For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Chenxiao Wang <[email protected]>
@@ -573,7 +573,7 @@ tsql_openjson_with_columnize(Jsonb *jb, char *col_info)
if (token)
{
token = strtok(NULL, ")");
if (token)
if (token && atoi(token) > 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

what was it returning for max?

Copy link
Contributor Author

@chxwang chxwang Dec 16, 2024

Choose a reason for hiding this comment

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

For nvarchar(max), token is -8000, here col_size was set as -8000
Adding this condition will make col_size the default size INT_MAX

@chxwang chxwang requested a review from Deepesh125 December 17, 2024 03:32
@Deepesh125 Deepesh125 merged commit a0aba15 into babelfish-for-postgresql:BABEL_4_X_DEV__PG_16_X Dec 17, 2024
2 checks passed
@Deepesh125 Deepesh125 deleted the jira-babel-5054 branch December 17, 2024 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants