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 using BigInt #37

Closed
alberto-fernandez-otm opened this issue Oct 20, 2021 · 3 comments
Closed

Error with parameterized LIMIT using BigInt #37

alberto-fernandez-otm opened this issue Oct 20, 2021 · 3 comments

Comments

@alberto-fernandez-otm
Copy link

Driver version

2.1.0.1

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

Client Operating System

Mac OS X

JAVA/JVM version

8, 11

Problem description

Cannot send BigInteger as binding for a parameterized LIMIT. We use Clojure, and clojure uses BigInt by default for literal numbers, so the following statement sends a BigInteger as the limit:

(jdbc/query rdb ["SELECT * FROM table LIMIT ?" 100])

And we are receiving the following error:

;   Detail: 
  -----------------------------------------------
  error:  Not implemented
  code:      1001
  context:   'IsA(cons, Const)' - 
  query:     1573873
  location:  pg_utils.cpp:6213
  process:   padbmaster [pid=25361]
  -----------------------------------------------

When explicitly coercing to Integer, it works

(jdbc/query rdb ["SELECT * FROM table LIMIT ?" (int 100)])

Is this expected behaviour and thus all Limit should be ensured to be ints, or is it a bug? We were not having this problem with version 1.x of the driver, we recently upgraded to 2.1 and this happened.

@iggarish
Copy link
Contributor

Thanks for reporting an issue. Please generate the driver log and also if possible please send a sample to reproduce it.

@iggarish
Copy link
Contributor

I can reproduce via setObject(paramIndex, BigInteger.valueof(100)). As such server throws the above error when driver tries to bind as Numeric type. As a work around, I change the driver code to use BigInteger as String type as bind and it works fine. This fix will release in 2.1.0.2. This is schedule soon.

@iggarish
Copy link
Contributor

Released the fix in 2.1.0.2 version.

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

2 participants