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 2022/06/24 01:17:55 UTC

[GitHub] [shardingsphere] 924438567 opened a new issue, #18556: java.sql.SQLException: Field 'id' doesn't have a default value

924438567 opened a new issue, #18556:
URL: https://github.com/apache/shardingsphere/issues/18556

   mybatis3.5.9 + sharding jdbc5.1.1
   
   sql:
   
   insert into qy_barrage(cus_no, send_time, barrage, create_time, update_time, create_user, update_user)
   values (#{cusNo}, #{sendTime}, #{barrage}, #{createTime}, #{updateTime}, #{createUser}, #{updateUser})
   database
   CREATE TABLE qy_barrage_aaa_2022 (
   id bigint unsigned NOT NULL,
   
   ```
   spring:
     shardingsphere:
       datasource:
         names: ds0
         ds0:
           url: jdbc:mysql://localhost:3306/data_op
           username: root
           password: 924438567
           driver-class-name: com.mysql.cj.jdbc.Driver
           type: com.zaxxer.hikari.HikariDataSource
       rules:
         sharding:
           tables:
             qy_barrage:
               actual-data-nodes: ds0.qy_barrage_$->{'(。)*'}_$->{2022..9999}
               table-strategy:
                 complex:
                   sharding-columns: cus_no,send_time
                   sharding-algorithm-name: complexDsAlgorithm
               key-generate-strategy:
                 column: id
                 key-generator-name: snow
           sharding-algorithms:
             complexDsAlgorithm:
               props:
                 sharding-columns: cus_no,send_time
                 algorithm-expression: qy_barrage_$->{cus_no}_$->{send_time.split("-")[0]}
               type: COMPLEX_INLINE
           key-generators:
             snow:
               type: SNOWFLAKE
       props:
         sql-show: true
   mybatis:
     mapper-locations: classpath:mapper/*.xml
   ```
   
   but when I change the actual-data-nodes from ds0.qy_barrage_$->{'(。)*'}$->{2022..9999} to ds0.qy_barrage ->{2022..9999}, it works correctly!!! why?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1165169999

   Did  mean `。` or `.`? 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1165132922

   > Is your configuration correct? There are Chinese character `。` in your code.
   
   I see in  groovy grammar, (。) means everything.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166320709

   > thank you ,where is a description of the usage of inline expressions?
   
   @924438567  Hah, sorry, I lost the link: 
   https://shardingsphere.apache.org/document/current/en/features/sharding/concept/inline-expression/


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166555050

   Hi @924438567 
   You should provide `Logic SQL` and `Actual SQL` so others can better understand your problem.
   Given your unique configuration, it is recommended to provide a demo project that reproduces the problem.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1165121101

   Is your configuration correct? There are Chinese character `。` in your code.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] dym254661025 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
dym254661025 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1206199205

   I have encountered the same problem. How can I solve it?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166291186

   > Hi @924438567 Here is a description of the usage of inline expressions, hope it can help you.
   thank you ,where is a description of the usage of inline expressions?
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166731373

   > Hi @924438567 You should provide `Logic SQL` and `Actual SQL` so others can better understand your problem. Given your unique configuration, it is recommended to provide a demo project that reproduces the problem.
   
   Logic SQL: insert into qy_barrage(cus_no, send_time, barrage, create_time, update_time, create_user, update_user)
           values (?, ?, ?, ?, ?, ?, ?)
   Actual SQL: ds0 ::: insert into qy_barrage_sss11_2023(cus_no, send_time, barrage, create_time, update_time, create_user, update_user)
           values (?, ?, ?, ?, ?, ?, ?) ::: [sss11, 2023-02-02 11:00:00, null, null, null, null, null]
   
   I use SNOWFLAKE to create id,  but  without id column.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN closed issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value
URL: https://github.com/apache/shardingsphere/issues/18556


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1190086926

   Close due to no response.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1168119312

   > Logic SQL: insert into qy_barrage(cus_no, send_time, barrage, create_time, update_time, create_user, update_user)
   values (?, ?, ?, ?, ?, ?, ?)
   Actual SQL: ds0 ::: insert into qy_barrage_sss11_2023(cus_no, send_time, barrage, create_time, update_time, create_user, update_user)
   values (?, ?, ?, ?, ?, ?, ?) ::: [sss11, 2023-02-02 11:00:00, null, null, null, null, null]
   
   I can't find any problem from the SQL, please provide a demo that reproduces the issue.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1171840492

   @bug-marker  So would you like to provide a demo for investigation? 


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166321568

   > > thank you ,where is a description of the usage of inline expressions?
   > 
   > @924438567 Hah, sorry, I lost the link: https://shardingsphere.apache.org/document/current/en/features/sharding/concept/inline-expression/
   
   thanks,but it may not  help the problem.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1165174533

   > 
   
   when I change `。`to `. `  ,the project starts error,  shows  the problem  "Invalid format for actual data nodes: 'ds0.qy_barrage_(.)*_2022'"。


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
RaigorJiang commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166196011

   Hi @924438567 
   Here is a description of the usage of inline expressions, hope it can help you.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1165174736

   > Do you mean `。` or `.`?
   
   when I change 。to . ,the project starts error, shows the problem "Invalid format for actual data nodes: 'ds0.qy_barrage_(.)*_2022'"。


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1168120871

   > I use SNOWFLAKE to create id, but without id column.
   
   
   
   > > Logic SQL: insert into qy_barrage(cus_no, send_time, barrage, create_time, update_time, create_user, update_user)
   > > values (?, ?, ?, ?, ?, ?, ?)
   > > Actual SQL: ds0 ::: insert into qy_barrage_sss11_2023(cus_no, send_time, barrage, create_time, update_time, create_user, update_user)
   > > values (?, ?, ?, ?, ?, ?, ?) ::: [sss11, 2023-02-02 11:00:00, null, null, null, null, null]
   > 
   > I can't find any problem from the SQL, please provide a demo that reproduces the issue.
   
   the problem is  I use SNOWFLAKE to create id, but Actual SQL without id column.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166330242

   > > thank you ,where is a description of the usage of inline expressions?
   > 
   > @924438567 Hah, sorry, I lost the link: https://shardingsphere.apache.org/document/current/en/features/sharding/concept/inline-expression/
   
   I see in source code,
   
   ```
   class: InsertClauseShardingConditionEngine
   
   method: private void appendGeneratedKeyConditions(final InsertStatementContext sqlStatementContext, final List<ShardingCondition> shardingConditions) {
           Optional<GeneratedKeyContext> generatedKey = sqlStatementContext.getGeneratedKeyContext();
          
   ```
   
   due to my configuration, generatedKey is null , so snowflake is unuseful,  id can not be formed , what should i do ?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] 924438567 commented on issue #18556: java.sql.SQLException: Field 'id' doesn't have a default value

Posted by GitBox <gi...@apache.org>.
924438567 commented on issue #18556:
URL: https://github.com/apache/shardingsphere/issues/18556#issuecomment-1166330184

   > Do you mean `。` or `.`?
   
   I see in source code,
   
   ```
   class: InsertClauseShardingConditionEngine
   
   method: private void appendGeneratedKeyConditions(final InsertStatementContext sqlStatementContext, final List<ShardingCondition> shardingConditions) {
           Optional<GeneratedKeyContext> generatedKey = sqlStatementContext.getGeneratedKeyContext();
          
   ```
   
   due to my configuration, generatedKey is null , so snowflake is unuseful,  id can not be formed , what should i do ?


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org