seata Mysql field name has space cause undo sql syntax error

6mw9ycah  于 2个月前  发布在  Mysql
关注(0)|答案(2)|浏览(50)
  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

Mysql field name has space cause undo sql syntax error, and rollback will fail.
our Mysql table sku has a field named current_ quantity .

Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

2021-04-22 17:26:38.561  INFO 41280 --- [h_RMROLE_1_2_16] i.seata.rm.datasource.DataSourceManager  : branchRollback failed. branchType:[AT], xid:[192.168.1.35:8091:128548377206075392], branchId:[128548409888092160], resourceId:[jdbc:mysql://*****/***], applicationData:[null]. reason:[Branch session rollback failed and try again later xid = 192.168.1.35:8091:128548377206075392 branchId = 128548409888092160 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'quantity = 7240, update_time = '2021-04-21 15:00:33.0' WHERE sku_id = 1068' at line 1]
2021-04-22 17:26:38.562  INFO 41280 --- [h_RMROLE_1_2_16] io.seata.rm.AbstractRMHandler            : Branch Rollbacked result: PhaseTwo_RollbackFailed_Retryable

Ⅲ. Describe what you expected to happen

rollback success

Ⅳ. How to reproduce it (as minimally and precisely as possible)

  1. use any table with field has space in your service
  2. make globalTransaction fail and rollback

Ⅴ. Anything else we need to know?

  1. using space in mysql field is not good idea
  2. By looking at the source code, ColumnUtils.addEscape only esacpe keyword column name

Ⅵ. Environment:

  • JDK version : 1.8
  • OS : macos Big Sur 11.1
  • Others: Seata-Server 1.4.1 / Clien seata-spring-boot-starter 1.41
pprl5pva

pprl5pva1#

why MySQL field name has space?

x7yiwoj4

x7yiwoj42#

why MySQL field name has space?

我们的数据库在命名时犯的一个错,所以字段里面带了个空格,可以通过修改我们的表结构来解决这个问题。
但既然Mysql支持这样命名,对于Seata来讲,这并不是一种错误,应该支持这种命名

相关问题