apache / shardingsphere

Distributed SQL transaction & query engine for data sharding, scaling, encryption, and more - on any database.
Apache License 2.0
19.82k stars 6.71k forks source link

Postgresql : not support function row_number() #29137

Open agoodcoolman opened 10 months ago

agoodcoolman commented 10 months ago

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

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?

5.4.1

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

ShardingSphere-Proxy apache-shardingsphere-5.4.1-shardingsphere-proxy-bin

Expected behavior

create table sql CREATE TABLE memberinfo ( id INT PRIMARY KEY, name VARCHAR(50), idcard VARCHAR(50), house_id VARCHAR(50),relation INT;

insert into sample data. insert into memberinfo (id, name, idcard, house_id, relation) values (1, '张三', '421106199901011234', "123456houseid", 1) ,(2, '李四', '42110619900101789', "123456houseid", 1)

query sql select house_id, relation, row_number() over (partition by house_id ORDER BY relation asc ) AS relation_index from memberinfo where house_id = '123456houseid'

sharding-config

image

expected result:

image

Actual behavior

relation_xuhao coloum 1,1 is error. image

expected result relation_index is 1,2. image

Reason analyze (If you can)

in postgrmaybe not support.

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

in database: Postgresql
query sql 'select house_id, relation, row_number() over (partition by house_id ORDER BY relation asc ) AS relation_index from memberinfo where house_id = '123456houseid''

in Postgresql, function row_number() is not work

RaigorJiang commented 10 months ago

Hi @agoodcoolman , Thanks for your feedback, are you intrested in improving it?

agoodcoolman commented 10 months ago

I'll try it.

agoodcoolman commented 10 months ago

@RaigorJiang sorry, I don't have time to modify this issue.

RaigorJiang commented 10 months ago

@agoodcoolman OK, I'll mark this issue as volunteer wanted, thank you~

github-actions[bot] commented 9 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

zt9788 commented 8 months ago

mysql not support ROW_NUMBER() OVER (ORDER BY id) too ,in shardingshpere5.3.2 @RaigorJiang dose it will support in next version? or plan to support it

github-actions[bot] commented 7 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

shubham-j-sde commented 5 months ago

Hey @agoodcoolman I've been trying to reproduce the issue, using ShardingSphereProxy 5.4.1 and Postgres 16.2 with Zookeeper 3.9.2 as Cluster Type . Have used the sharding-config you have posted (naming it as sharding_db).

But row_number() seems to be working fine:

Screenshot 2024-04-20 at 2 55 45 AM

can you share postgres version, mode configuration and probably a sample dataset to look into this further.

also, @RaigorJiang , i'll like to try resolving this issue. Thanks

github-actions[bot] commented 4 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.