-
Notifications
You must be signed in to change notification settings - Fork 100
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
Update logic for LIKE operator for Case Insensitive collation #3439
Open
ahmed-shameem
wants to merge
35
commits into
babelfish-for-postgresql:BABEL_5_X_DEV
Choose a base branch
from
amazon-aurora:update-like-logic
base: BABEL_5_X_DEV
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Update logic for LIKE operator for Case Insensitive collation #3439
ahmed-shameem
wants to merge
35
commits into
babelfish-for-postgresql:BABEL_5_X_DEV
from
amazon-aurora:update-like-logic
+12,640
−152
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: Shameem Ahmed <shameemahmed20apr2000@gmail.com>
Pull Request Test Coverage Report for Build 13695695834Details
💛 - Coveralls |
Deepesh125
reviewed
Jan 31, 2025
…d leftop for other BOOL operators
This reverts commit 999c4be.
Deepesh125
requested changes
Feb 20, 2025
kuntalghosh
reviewed
Feb 24, 2025
Signed-off-by: Shameem Ahmed <shameemahmed20apr2000@gmail.com>
forestkeeper
reviewed
Mar 5, 2025
test/JDBC/upgrade/latest/schedule
Outdated
@@ -607,3 +607,4 @@ sys_sql_logins | |||
sys-login-property | |||
sys-fn-varbintohexsubstring | |||
BABEL_OBJECT_RESOLUTION_IN_ROUTINES | |||
BABEL-5608 |
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.
BABEL-5608 is only schedule in the latest version upgrade test ? Why ?
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.
Added in other upgrade paths as well
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.
Description
We have supported LIKE from TSQL side for case insensitive collation by transforming LIKE to ILIKE (this is a PG operator which sorts strings case insensitively based on active locale). We have also introduced optimisation in place for the case when the rightop of the LIKE operator is a Const node and has prefix. Eg:
-- CASE 1
-- CASE 2
This is the optimisation that we follow:
will become if pattern has exact match
will become if pattern has prefix match
E’\uFFFF is the highest sort key. We use the BETWEEN operator as in PG we can NOT use index scan for LIKE/ILIKE operator. Whereas introducing BETWEEN will enable us to do so. And the CS_AS collation is used to store the locale info for ILIKE.
For supporting case insensitive accent insensitive collations like latin1_general_ci_ai , we transform the node firstly by adding a FuncExpr (remove_accents_internal) which removes the accent and then we apply the above logic.
Currently we have observed that we do not comply with the transformation above. Rather than COLLATE CS_AS, we observe COLLATE “default” in query plan. Consider the following query:
-- query (column a is collated with latin1_genetal_ci_as)
-- query plan
Even though we observe COLLATE "default" in the query plan, it picks up the correct collation oid during execution.
However, if we update the collation oid in typeTypeCollation function to pickup database collation oid for string literals in parse tree, we may observe upgrade/restore failure.
We use this task as first step to modify and incorporate improvements for such cases.
Issues Resolved
Task: BABEL-5608
Signed-off-by: Shameem Ahmed shmeeh@amazon.com
Test Scenarios Covered
Use case based -
Boundary conditions -
Arbitrary inputs -
Negative test cases -
Minor version upgrade tests -
Major version upgrade tests -
Performance tests -
Tooling impact -
Client tests -
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.