-
Notifications
You must be signed in to change notification settings - Fork 176
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
Allow escaping of '?' using '??' in SQL expression #1935
Conversation
Is there anything I need to do to have this looked at by maintainers? or just patience? |
Could You please provide there examples of SQL (jsonb) query where |
The fix is not specific to Postgres, nor JSON, really. I just happen to run into this because Postgres uses '?' as an operator in many of its operators on JSONB: Oracle also uses '?' as an operator within its JSON_EXISTS As for an example, the following JPA query is not possible on Postgres without this fix: ↑ Note that I used two question marks where I want a literal question mark, rather than specifying a parameter in a parameterized query. This works with my proposed fix in this PR. |
Please extend this PR with test. Good candidate where to put it into new method is There is some example query against Oracle Example how to restrict test/code against some platform |
I'll give it a go but I don't have the full environment to test the tests so it may take a few trial and error commits. |
Done. Test case added. |
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.
Please update copyright year in TestJson.java into
....Copyright (c) 2022, 2023....
jpa/eclipselink.jpa.test.jse/src/it/java/org/eclipse/persistence/jpa/json/TestJson.java
Outdated
Show resolved
Hide resolved
...g.eclipse.persistence.core/src/main/java/org/eclipse/persistence/expressions/Expression.java
Show resolved
Hide resolved
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
@rfelcman I would like to backport this to 4.0. Is there a policy or process for that or do I just submit a separate PR to the 4.0 branch? |
Just create new PR against 4.0 branch. |
Allow escaping of '?' using '??' in SQL expression and testEscapedQuestionMarkInSQLOperator to test ?? in SQL operator
Thank you. |
Using SQL operator, it is not possible to use '?' as a native operator (e.g. on Postgres). This PR is to allow using '??' as an escape mechanism, similar to the escaping mechanism used by Postgres JDBC.
This is to fix issue #836