Skip to content

SelectBuilder's .join(...).on(X).equals(Y) assumes X/Y are *not* Expressions.just(...) expressions #1009

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

Closed
nt-gt opened this issue Jul 15, 2021 · 0 comments
Assignees
Labels
in: selectbuilder SelectBuilder stands for the complete API for creating SQL statements programmatically. type: enhancement A general enhancement

Comments

@nt-gt
Copy link

nt-gt commented Jul 15, 2021

Hi,

Follow up on #995 with a separate issue. Attempting to use Expressions.just to work around #995, I learned that SelectBuilder ignores Expressions.just and "silently" generates invalid SQL. Consider the following code:

        Table transport = Table.create("transport");
        Table transportCall = Table.create("transport_call");
        Select finalSelect = Select.builder().select(transportCall.asterisk())
                .from(transportCall)
                .join(transport).on(Expressions.just("bar")).equals(Expressions.just("foo"))
                .build();

This generates the following invalid SQL:

SELECT transport_call.*
 FROM transport_call
 JOIN transport ON 

Notice how everything after ON-clause is omitted. (If you add a .where(...) then you will end up with JOIN transport ON WHERE ...)

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 15, 2021
@schauder schauder self-assigned this Jul 19, 2021
@schauder schauder added type: enhancement A general enhancement in: selectbuilder SelectBuilder stands for the complete API for creating SQL statements programmatically. and removed status: waiting-for-triage An issue we've not yet triaged labels Jul 19, 2021
schauder added a commit that referenced this issue Jul 22, 2021
schauder added a commit that referenced this issue Jul 30, 2021
schauder added a commit that referenced this issue Jul 30, 2021
This commit contains just a test to verify this.
The actual fix happened as part of #1018.

Closes #1009.
Original pull request #1015
See #1018
schauder added a commit that referenced this issue Jul 30, 2021
See #1009
Original pull request #1015
mp911de pushed a commit that referenced this issue Sep 28, 2021
mp911de pushed a commit that referenced this issue Sep 28, 2021
This commit contains just a test to verify this.
The actual fix happened as part of #1018.

Closes #1009.
Original pull request #1015
See #1018
@mp911de mp911de added this to the 2.3 RC1 (2021.1.0) milestone Sep 28, 2021
mp911de added a commit that referenced this issue Sep 28, 2021
See #1009
Original pull request: #1015.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: selectbuilder SelectBuilder stands for the complete API for creating SQL statements programmatically. type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants