apache / apache/incubator-seata

sharding-jdbc无法解析路由seata生成的查询语句

Open
#4,093 5 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

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

### Ⅰ. Issue Description
sharding-jdbc分表后使用seata,seata生成的操作表查询语句sharding-jdbc无法路由,因为生成的主键被括号包了起来,sharding-jdbc无法解析该字段

### Ⅱ. Describe what happened

![image](https://user-images.githubusercontent.com/55438404/138625576-490d32f0-dc4a-4468-bd73-6039d5dca206.png)
此处将主键单独使用括号包了起来
![image](https://user-images.githubusercontent.com/55438404/138626667-23775c14-6ff4-4413-a0dc-52e182757bcd.png)

### Ⅲ. Describe what you expected to happen
是否能取消生成的sql语句主键外的括号呢?比如该处语句变为:SELECT * FROM task_refresh_package_log WHERE id in ( (?) )

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

1.集成sharding-jdbc
2. 将要操作的表使用sharding-jdbc分库分表,主键作为分表字段

### Ⅵ. Environment:

- JDK version :1.8
- Seata version: 1.4.2
- OS :windows
- Others:sharding-jdcb:4.1.1

Contributor guide

Open the contributing guide

Research direction

Reproduce the integration described with Seata 1.4.2, sharding-jdbc 4.1.1, and a sharded table whose primary key is the sharding field. Inspect the generated query and sharding-jdbc routing behavior, then verify that the primary-key expression is parsed correctly and the reported SELECT form routes successfully.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.