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

INSERT with SetOperations #1531

Merged
merged 7 commits into from
May 15, 2022

Conversation

manticore-projects
Copy link
Contributor

@manticore-projects manticore-projects commented May 8, 2022

Simplify the INSERT production
Use SetOperations for Select and Values
Better Bracket handling for WITH ... SELECT ...
Fixes #1491

Following statements will work now:

(
    with a as (select * from dual) 
    select * from a
);

insert into table1 (tf1,tf2,tf2) (   
    (select sf1,sf2,sf3 from s1)
    union (select rf1,rf2,rf2 from r1)
);

Simplify the INSERT production
Use SetOperations for Select and Values
Better Bracket handling for WITH ... SELECT ...
Fixes JSQLParser#1491
Appease Codazy/PMD
Appease Codazy/PMD
List the changes
Minor rephrases
Correct the Maven Artifact Example
@wumpz
Copy link
Member

wumpz commented May 11, 2022

please resolve conflicts

@wumpz wumpz merged commit b5672c5 into JSQLParser:master May 15, 2022
@wumpz
Copy link
Member

wumpz commented May 15, 2022

After merging I am not able to compile anymore.

@manticore-projects
Copy link
Contributor Author

After merging I am not able to compile anymore.

What is the challenge please?
Have you tried gradle build? The CI passed before.

@manticore-projects
Copy link
Contributor Author

Confirmed, I get the same problem -- very strange. How did the CI succeed?
I will fix that tomorrow morning, whatever it is.

@wumpz
Copy link
Member

wumpz commented May 15, 2022

I am not able to correct this since

Select SelectWithWithItems( ):
{
    Select select;
    List<WithItem> with = null;
}
{
    LOOKAHEAD(2) ( 
        "(" with=WithList()  select = Select( with ) ")" { select.withUsingWithBrackets(true); }
    )
    |
    (
         [ with=WithList() ] select = Select( with )
    )

    {
        return select;
    }
}

yields

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project jsqlparser: Compilation failure: Compilation failure: 
/C:/work/java/JSqlParser/target/generated-sources/javacc/net/sf/jsqlparser/parser/CCJSqlParser.java:[5631,9] unreachable statement
/C:/work/java/JSqlParser/target/generated-sources/javacc/net/sf/jsqlparser/parser/CCJSqlParser.java:[5639,1] missing return statement
-> [Help 1]

This one I know from switching to modern JavaCC templating. Very strange.

@wumpz
Copy link
Member

wumpz commented May 15, 2022

I pushed a running version. To get this state I had to remove the changes from

SelectWithWithItems production
and disabled tests in InsrtTest (testInsertOutputClause, one assert in testInsertWithSelect)

@wumpz
Copy link
Member

wumpz commented May 15, 2022

Here only the Codacy and Merge checks were presented. Your change was perfectly mergeable, but this means not automatically compilable.

@wumpz
Copy link
Member

wumpz commented May 15, 2022

Corrected grammar. It was semantically incomplete.

@wumpz
Copy link
Member

wumpz commented May 15, 2022

  1. Tests reactivated again.
  2. deparser and toString for OutputClause implemented

so this seems to be complete now

@manticore-projects
Copy link
Contributor Author

Good Morning,

thank you for sorting this out. I am really sorry for this mess, no idea what happened.
I build and test every single time, before I push -- however, checking out this PR, I found those missing part myself and was able to reproduce the problem. Very odd. I can only imagine, that I merged wrongly when resolving conflicts after the previous PR has been accepted.

Sorry again and cheers!

@wumpz
Copy link
Member

wumpz commented May 16, 2022

No problem. However, strange that this happended. BTW I found out, that travis-ci does not work since a couple of month, even that there are a lot of free build credits left. I opened a new issue here. Maybe its time to switch to Github Actions.

@manticore-projects
Copy link
Contributor Author

Maybe its time to switch to Github Actions.

Yes please, I'd like to support that, because I really do not like it when things suddenly stop to work -- without notice.
This commit should have been rejected and sent me a message at least.

@wumpz
Copy link
Member

wumpz commented May 16, 2022

Github Action Maven build activated. I have no idea how to configure this Gradle build to use multiple JDKs.

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

Successfully merging this pull request may close these issues.

can not parser union select clause in insert query
2 participants