You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
can not parser union select clause in insert query #1491
I mock a simple insert query like this
insert into table1 (tf1,tf2,tf2)
((select sf1,sf2,sf3 from s1) union (select rf1,rf2,rf2 from r1))
and get follow paseexception:
net.sf.jsqlparser.JSQLParserException: Encountered unexpected token: "union" "UNION"
at line 2, column 31.
Was expecting one of:
In my opinion, we need to refactor the whole INSERT production to make this work.
Currently, it supports (SELECT) (with maximum one embracing set of bracket). But in fact, this should be an EXPRESSION with possible many embracing brackets (e. g. INSERT INTO ... ( ( ( SELECT ... FROM ... ) ) ))
This leads to the general question, how we want to treat redundant brackets:
a) we strip them and suppress them (which is better for performance at the cost the alter the original statement)
b) OR we keep them (which would be bad for performance, as we have to treat everything as a Complex Expression)
c) OR we try to count them and change the Boolean hasBrackets into an Integer numberOfBrackets (most complicated though)
Activity
manticore-projects commentedon Mar 20, 2022
Greetings.
Confirmed with JSQLParser 4.4 Snapshot.
The brackets in combination with the
INSERTare the problem, without the brackets it works:Without the
INSERTit also works:I will need to look into the
INSERTproduction.manticore-projects commentedon Mar 22, 2022
In my opinion, we need to refactor the whole
INSERTproduction to make this work.Currently, it supports
(SELECT)(with maximum one embracing set of bracket). But in fact, this should be anEXPRESSIONwith possible many embracing brackets (e. g.INSERT INTO ... ( ( ( SELECT ... FROM ... ) ) ))This leads to the general question, how we want to treat redundant brackets:
a) we strip them and suppress them (which is better for performance at the cost the alter the original statement)
b) OR we keep them (which would be bad for performance, as we have to treat everything as a Complex Expression)
c) OR we try to count them and change the Boolean
hasBracketsinto an IntegernumberOfBrackets(most complicated though)@wumpz: Your opinion please? I tend to strip it.
INSERT with SetOperations
INSERT with SetOperations (#1531)