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

Return varchar type for substr function with char argument #3599

Merged
merged 1 commit into from Jun 7, 2020

Conversation

ebyhr
Copy link
Member

@ebyhr ebyhr commented May 2, 2020

Fixes #3456

@cla-bot cla-bot bot added the cla-signed label May 2, 2020
assertFunction("SUBSTR(CAST('Quadratically' AS CHAR(13)), 0, 4)", createVarcharType(13), "");
assertFunction("SUBSTR(CAST('Quadratically' AS CHAR(13)), 5, 0)", createVarcharType(13), "");

assertFunction("SUBSTR(CAST('abc def' AS CHAR(7)), 1, 4)", createVarcharType(7), "abc ");
Copy link
Member

Choose a reason for hiding this comment

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

do we have a test ensuring trailing space is preserved?
like

assertFunction("SUBSTR(CAST('keep trailing' AS CHAR(14)), 1, 14)", createVarcharType(14), "keep trailing ");

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I was missing the case. Updated.

@ebyhr ebyhr merged commit fbc313e into trinodb:master Jun 7, 2020
@ebyhr ebyhr deleted the substr branch June 7, 2020 10:18
@ebyhr ebyhr mentioned this pull request Jun 7, 2020
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Substr to a CHAR(n) column returns padded string
2 participants