-
Notifications
You must be signed in to change notification settings - Fork 97
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 CASE statement when branch expression is of String Datatype. #2931
Merged
Deepesh125
merged 54 commits into
babelfish-for-postgresql:BABEL_4_X_DEV
from
amazon-aurora:BABEL-5103-4_X
Oct 1, 2024
Merged
Fix CASE statement when branch expression is of String Datatype. #2931
Deepesh125
merged 54 commits into
babelfish-for-postgresql:BABEL_4_X_DEV
from
amazon-aurora:BABEL-5103-4_X
Oct 1, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
…OBJECT_ID Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
tanscorpio7
reviewed
Sep 14, 2024
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Pull Request Test Coverage Report for Build 11109698756Details
💛 - Coveralls |
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
…verify.out Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
Yvinayak07
changed the title
Setting the correct common_type of CASE statement.
Fix CASE statement when branch expression is of NVARCHAR type.
Sep 18, 2024
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
sumitj824
reviewed
Sep 20, 2024
sumitj824
reviewed
Sep 20, 2024
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
rohit01010
reviewed
Sep 27, 2024
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
rohit01010
approved these changes
Sep 27, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
sumitj824
approved these changes
Sep 30, 2024
Deepesh125
previously approved these changes
Sep 30, 2024
Yvinayak07
changed the title
Fix CASE statement when branch expression is of NVARCHAR type.
Fix CASE statement when branch expression is of Sting Datatype.
Sep 30, 2024
Yvinayak07
changed the title
Fix CASE statement when branch expression is of Sting Datatype.
Fix CASE statement when branch expression is of String Datatype.
Sep 30, 2024
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
test/JDBC/expected/non_default_server_collation/chinese_prc_ci_as/BABEL-CASE_EXPR-vu-verify.out
Show resolved
Hide resolved
Signed-off-by: yashneet vinayak <[email protected]>
Signed-off-by: yashneet vinayak <[email protected]>
KushaalShroff
approved these changes
Oct 1, 2024
Deepesh125
merged commit Oct 1, 2024
43f1a57
into
babelfish-for-postgresql:BABEL_4_X_DEV
46 checks passed
1 task
Yvinayak07
pushed a commit
to amazon-aurora/babelfish_extensions
that referenced
this pull request
Oct 1, 2024
…elfish-for-postgresql#2931) Signed-off-by: yashneet vinayak <[email protected]>
This was referenced Oct 3, 2024
This was referenced Oct 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
1. Issue:
Return type of overall CASE expression when branch expression is of String Datatype, is evaluated as per Postgres behaviour, which gives a different Return type as compared to TSQL.
eg. Return type of overall CASE expression is evaluated to become VARCHAR, if all branches are of NVARCHAR type because Postgres tries to coerce result of every branch expression to base type (VARCHAR), whereas in TSQL, overall return type is NVARCHAR in this example.
Return type: varchar
expected type: nvarchar
2. Changes made to fix the issues
tsql_select_common_type_hook() is set to return common_type for all branches when branch expression is of String Datatype, that calculate according to the TSQL precedence, whereas till now it was set according to the PG precedence order (Which was different from TSQL).This hook solved our problem as it returns result according to the TSQL precedence order. We have also fixed the typmod issue, by calculating the common typmod and setting all branches of CASE statement to the calculated typmod.
Task: BABEL-5103, BABEL-4332
Authored-by: yashneet vinayak [email protected]
Signed-off-by: yashneet vinayak [email protected]
Issues Resolved
Task: BABEL-5103, BABEL-4332
Engine Side PR link: babelfish-for-postgresql/postgresql_modified_for_babelfish#452
Test Scenarios Covered
**Use case based -**Yes
Boundary conditions -
**Arbitrary inputs -**Yes
Negative test cases -
**Minor version upgrade tests -**Yes
**Major version upgrade tests -**Yes
Performance tests -
Tooling impact -
**Client tests -**Yes
Check List
By submitting this pull request, I confirm that my contribution is under the terms of the Apache 2.0 and PostgreSQL licenses, 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.