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

Error with parameterized LIMIT, OFFSET using long #43

Closed
andreibuboi opened this issue Feb 10, 2022 · 3 comments
Closed

Error with parameterized LIMIT, OFFSET using long #43

andreibuboi opened this issue Feb 10, 2022 · 3 comments

Comments

@andreibuboi
Copy link

andreibuboi commented Feb 10, 2022

Driver version

2.1.0.4

Redshift version

PostgreSQL 8.0.2 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.2 20041017 (Red Hat 3.4.2-6.fc3), Redshift 1.0.34928

Client Operating System

Mac OS X

JAVA/JVM version

11

Problem description

Cannot send long type as binding for a parameterized LIMIT or OFFSET.

select value from table order by foo limit ? offset ?

The following error message appears:

 error:  Not implemented
  code:      1001
  context:   'IsA(cons, Const)' - 
  query:     865983
  location:  pg_utils.cpp:6474
  process:   padbmaster [pid=20521]

Reproduction code

  public static void main(String[] args) throws ClassNotFoundException {
    Class.forName("com.amazon.redshift.jdbc42.Driver");
    String url = "jdbc:redshift://{host}:{port}/{db_name}";
    String user = "{user}";
    String password = "{password}";
    try {
      Connection connection = DriverManager.getConnection(url, user, password);
      PreparedStatement ps = connection.prepareStatement("select value from table order by foo limit ? offset ?");
      ps.setObject(1, 2L);
      ps.setObject(2, 4L);
      ResultSet result = ps.executeQuery();
      while (result.next()) {
        String value = result.getString(1);
        System.out.println(value);
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }

I have tried with multiple 2.x versions. Works with 1.x versions of the driver though.

I saw a similar issue being fixed before for BigInteger parameter binding: #37

@Brooke-white
Copy link
Contributor

Thank you for reaching out about this, @andreibuboi, the team will look into this.

@iggarish
Copy link
Contributor

I can reproduce the issue. It looks like server side issue. I will open up ticket with server team.

@bhvkshah
Copy link
Contributor

@andreibuboi I am unable to reproduce this issue anymore, and am hence closing it. If you are still having issues, please let me know with appropriate reproduction steps/logs and I'll be happy to reopen this for you.

Thank you for your contribution to the Redshift JDBC 2.x Driver!

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

No branches or pull requests

4 participants