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

Like with an escape clause fails #1386

Open
olavloite opened this issue Feb 10, 2024 · 2 comments
Open

Like with an escape clause fails #1386

olavloite opened this issue Feb 10, 2024 · 2 comments
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@olavloite
Copy link
Collaborator

ERROR: Postgres function like_escape(text, text) is not supported - Statement: 'select s1_0.id,s1_0.active,s1_0.created_at,s1_0.first_name,s1_0.full_name,s1_0.last_name,s1_0.updated_at from singers s1_0 where s1_0.last_name like $1 escape '\''
@olavloite olavloite added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Feb 10, 2024
@amuware
Copy link

amuware commented Jul 16, 2024

Hello,
we are facing the same issue:
@Query("SELECT r FROM DNSRecordEntity r WHERE LOWER(r.name) LIKE LOWER(?1) OR LOWER(r.irn) LIKE LOWER(?1)")

{"code":"500","message":"JDBC exception executing SQL ...ERROR: Postgres function like_escape(text, text) is not supported - Statement: 'select ... from ttdev de1_0 where lower(de1_0.name) like lower($1) escape '' or lower(de1_0.xx) like lower($2) escape '''] [n/a]","status":"Internal Server Error"}

is there any solution ?
Thanks

@olavloite
Copy link
Collaborator Author

It depends a bit on the use case. One possible option could be to use the starts_with function like in this example:

@Query("SELECT s FROM Singer s WHERE cast(starts_with(s.lastName, :lastName) as boolean)")

If that is not an option in your case, then I can have a look at adding a query replacement in PGAdapter. We already replace some known function calls and statements, so this could be added to that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants