You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/09/27 06:30:51 UTC

[GitHub] [incubator-shardingsphere] beiwangnull opened a new issue #3135: insert into set not supported

beiwangnull opened a new issue #3135: insert into set not supported
URL: https://github.com/apache/incubator-shardingsphere/issues/3135
 
 
   ### Which version of ShardingSphere did you use?
   4.0.0-RC
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC
   ### Expected behavior
   Using SQL grammar:insert into set
   ### Actual behavior
   return error
   ### Reason analyze (If you can)
   sharding does not support
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   ```
   mybatis:
   <sharding:inline-strategy id="orderTableStrategy" sharding-column="order_id" algorithm-expression="t_order$->{order_id % 2}" />
       <sharding:data-source id="shardingDataSource">
           <sharding:sharding-rule data-source-names="ds0">
               <sharding:table-rules>
                   <sharding:table-rule logic-table="t_order" actual-data-nodes="ds0.t_order$->{0..2}" table-strategy-ref="orderTableStrategy"/>
               </sharding:table-rules>
           </sharding:sharding-rule>
       </sharding:data-source>
   
   mapper:
       <sql id="set">
           `username`=#{username}
       </sql>
       <insert id="add" parameterType="java.lang.String">
           insert  into user
           <set>
               <include refid="set"/>
           </set>
       </insert>
   
   return error:
   ### Error updating database.  Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
   ### The error may involve com.tuya.springmvc.repository.UserRepository.add-Inline
   ### The error occurred while setting parameters
   ### SQL: insert  into user          SET `username`=?
   ### Cause: java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
   ; SQL []; Parameter index out of range (1 > number of parameters, which is 0).; nested exception is java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).] with root cause
    java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).
   
   table user has no sharding, Share a database with the t_order table,but insert into t_order was success
   
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services