apache / apache/incubator-seata

insert into values select 时,seata解析sql报错

Open
#2,533 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

- [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description

在插入数据时,其中的一个字段值是查询出来的,seata报错

### Ⅱ. Describe what happened
在插入数据时,其中的一个字段值是查询出来的,sql日志大概如下:
SQL: INSERT INTO t_tb_a( id, amount, )values( ?, ((select balance from t_tb_b where code = ?) - 1100.0))

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

### Cause: java.sql.SQLException: io.seata.rm.datasource.sql.SQLParsingException: Unknown SQLExpr: class com.alibaba.druid.sql.ast.expr.SQLBinaryOpExpr (
SELECT balance
FROM t_tb_b
WHERE code = ?
) - 1100.0

```
Just paste your stack trace here!
```

### Ⅲ. Describe what you expected to happen

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

1. xxx
2. xxx
3. xxx

### Ⅴ. Anything else we need to know?

### Ⅵ. Environment:

- JDK version :1.8
- OS : centos 7
- Others: seata1.1.0 springcloud-alibaba 2.2.0 mybatis

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported INSERT ... VALUES case from the issue on Seata 1.1.0 with JDK 1.8, CentOS 7, Spring Cloud Alibaba, and MyBatis. Trace SQL parsing for the Druid SQLBinaryOpExpr shown in the exception; done means the expression parses without SQLParsingException and the insert completes as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.