Skip to content

In the opengauss database, when using limit ?, ?, the parameter parsing order is wrong #34961

@Y-sir

Description

@Y-sir

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

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

ShardingSphere-Proxy

Expected behavior

Image

Image

Actual behavior

Image

Reason analyze (If you can)

Printing in the log, it is found that the parameters after limit are caused by the order problem

Image

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

1、 CREATE TABLE employees ( id SERIAL PRIMARY KEY, name VARCHAR(50) NOT NULL, age INT CHECK (age > 18), department VARCHAR(50), salary DECIMAL(10,2) );

2、 INSERT INTO opengauss.employees (id, "name", age, department, salary) VALUES(1, '张三', 28, '研发', 12000.50); INSERT INTO opengauss.employees (id, "name", age, department, salary) VALUES(2, '李四', 29, '市场', 10800.00); INSERT INTO opengauss.employees (id, "name", age, department, salary) VALUES(3, '王五', 30, '销售', 12000.50); INSERT INTO opengauss.employees (id, "name", age, department, salary) VALUES(4, '赵六', 31, '经理', 20215.25);

3、 String sql = "SELECT * FROM employees order by id limit ? , ?;"; PreparedStatement psmt = conn.prepareStatement(sql); psmt.setInt(1,2); psmt.setInt(2,1);

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions