[ 
https://issues.apache.org/jira/browse/CALCITE-1527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15726928#comment-15726928
 ] 

Christian Tzolov commented on CALCITE-1527:
-------------------------------------------

If we implement {{INSERT ... <relational expression>}} using {{visitChid(0, 
<relational expression>)}} only, it will work for non-VALUES expression. But 
for {{VALUES}} it will hit the existing  
[vist(Values)|https://github.com/apache/calcite/blob/f57db602274411c683089b786d18a510ffcc432f/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java#L242].
 Later  always produces  {{SELECT}} | {{SELECT ... UNION...}} for {{INSERT ... 
VALUES}} and the generated SQL doesn't work on HSQLDB or Postgresql (haven't 
tested it with other dialects).  IMO this can be fixed if we change the 
visitValues implementation to something similar to 
[covertValues(Values)|https://github.com/apache/calcite/blob/f57db602274411c683089b786d18a510ffcc432f/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java#L387].
 But because of the VALUES-OUTSIDE-INSERT cases i didn't dare changing existing 
visit(Values) method. For the time being i've made it 
[conditional|https://github.com/apache/calcite/blob/f57db602274411c683089b786d18a510ffcc432f/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java#L325]
 inside the TableModify.INSERT method that delegates to covertValues(...) in 
case of INSERT ... VALUES
bq. I think SQL_INSERT_VALUES_OPERATOR can go.
Do you mean to keep it or remove it? :) Did you had the chance to review the 
[latest 
version|https://github.com/apache/calcite/blob/f57db602274411c683089b786d18a510ffcc432f/core/src/main/java/org/apache/calcite/rel/rel2sql/RelToSqlConverter.java#L309]
Regarding the tests with the last commit i've removed the @FixMethodOrder by 
trying to build the test fixtures in the {{doWithConnection}} instead. 


> Support DML in the JDBC adapter
> -------------------------------
>
>                 Key: CALCITE-1527
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1527
>             Project: Calcite
>          Issue Type: Bug
>          Components: jdbc-adapter
>            Reporter: Christian Tzolov
>            Assignee: Julian Hyde
>
> Currently the JDBC adapter does not support the DML operations: *INSERT*, 
> *DELETE* and  *UPDATE*.
> Solution needs to convert the parsed *Modify* and *Values* RelNodes into 
> *JdbcTableModify*, *JdbcValues* ... such and then in turn into corresponding 
> SqlInsert, SqlUpdate and SqlDelete.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to