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

@Query doesn't escape reserved keywords #2872

Open
melix opened this issue Apr 9, 2024 · 3 comments
Open

@Query doesn't escape reserved keywords #2872

melix opened this issue Apr 9, 2024 · 3 comments
Labels
type: improvement A minor improvement to an existing feature

Comments

@melix
Copy link
Contributor

melix commented Apr 9, 2024

Expected Behavior

If a method is annotated with @Query, I would expect the query to escape reserved keywords. For example:

@Query("update user set locked=true where id=:id")
void lock(Long id);

user is a reserved name in PostgreSQL.

Actual Behaviour

The user table is not escaped. Even if you use the following query:

@Query("update \"user\" set locked=true where id=:id")
void lock(Long id);

The converted query removes escaping.

Steps To Reproduce

No response

Environment Information

No response

Example Application

No response

Version

4.6.2

@sdelamo sdelamo added the type: improvement A minor improvement to an existing feature label Apr 19, 2024
@sdelamo
Copy link
Contributor

sdelamo commented Apr 19, 2024

@dstepanov @radovanradic maybe we could create a dictionary of reserved words per dialect

@dstepanov
Copy link
Contributor

We don't want to parse queries more than we do now (just to replace binding). If you use a custom query, you should be doing escaping; I'm not sure why, in this case, the escaping disappears.

@dstepanov
Copy link
Contributor

@melix I cannot reproduce your issue #2900

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: improvement A minor improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants