Skip to content

[WIP] Use force-quoting in R2dbcMappingContext by default #2047

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ShenFeng312
Copy link

@ShenFeng312 ShenFeng312 commented Apr 28, 2025

When I realized how many changes were required to support this, I started to feel that my approach might be flawed. Given that I don't fully understand the design, I felt that I shouldn't make such extensive modifications without fully understanding it.

In my understanding, when transforming an AST into SQL, special handling (such as formatting, ignoring comments, or quoting) is usually applied through a visitor.
However, in the current Spring implementation, the quoting behavior is decided at AST generation time rather than during SQL rendering.

This design means that if the quoting strategy needs to change, all related code must be modified, which increases the risk of omissions. Additionally, it is difficult to be certain which places do not require changes.
Therefore, I have temporarily put this work on hold and am seeking a better solution from the community.
@schauder suggested that I submit a PR to ensure that this issue is not missed in #1993

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 28, 2025
@mp911de mp911de added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 28, 2025
@mp911de mp911de linked an issue Apr 28, 2025 that may be closed by this pull request
@ShenFeng312
Copy link
Author

Please do not merge this PR. It is not yet fully edited, and it is very likely that it will not be further edited.

Copy link
Contributor

@schauder schauder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I realized how many changes were required to support this, I started to feel that my approach might be flawed.

There shouldn't really be that many changes.

What I would expect is the change to the default configuration, i.e. the R2dbcMappingContext and then tons of changes to the tests, since most of them use the default, which we are changing.

Everything else should stay the same, since we already support forced quoting if so configured.

Could you line out why you think you have to change so much more?

@@ -26,6 +26,7 @@
import java.util.function.Supplier;
import java.util.stream.Collectors;

import org.jetbrains.annotations.TestOnly;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are not using this annotation.

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

Successfully merging this pull request may close these issues.

Use force-quoting in R2dbcMappingContext by default
4 participants