Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In pgsql, the syntax ON CONFLICT (user_id,name) DO UPDATE SET is used, which cannot be routed to the real physical table when sharding. #32565

Open
seckill007 opened this issue Aug 17, 2024 · 0 comments

Comments

@seckill007
Copy link

Bug Report

In pgsql, the syntax ON CONFLICT (user_id,name) DO UPDATE SET is used, which cannot be routed to the real physical table when sharding.
For English only, other languages will not accept.

INSERT INTO t_user (user_id, name, age)
VALUES

(#{item.userId}, #{item.name}, #{item.age})

ON CONFLICT (user_id,name) DO UPDATE SET
age = EXCLUDED.age+t_user.age

when I used this pg sql style,shardingsphere didn't support.
Before report a bug, make sure you have:
image

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

org.apache.shardingsphere shardingsphere-jdbc-core 5.2.0

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-JDBC

Expected behavior

Actual SQL: db0 ::: INSERT INTO t_user2 (user_id, name, age)
VALUES

        (?, ?, ?), (?, ?, ?)
     
    ON CONFLICT (user_id,name) DO UPDATE SET
    age = EXCLUDED.age + t_user2.age ::: [123, test, 10, 789, test3, 11]  

Actual behavior

Actual SQL: db0 ::: INSERT INTO t_user2 (user_id, name, age)
VALUES

        (?, ?, ?), (?, ?, ?)
     
    ON CONFLICT (user_id,name) DO UPDATE SET
    age = EXCLUDED.age + t_user.age ::: [123, test, 10, 789, test3, 11]

Reason analyze (If you can)

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

Example codes for reproduce this issue (such as a github link).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants