pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: victornoel (@victornoel) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: [pgjdbc/pgjdbc] issue #3608: Support BigInteger[] in PgPreparedStatement#setObject(int, java.lang.Object)
Date: Thu, 17 Apr 2025 15:50:10 +0000
Message-ID: <[email protected]> (raw)
**Describe the issue**
Hi, I noticed that even though I can use `PreparedStatement.setObject` with an array of `BigInteger` I get the following exception:
```
Exception in thread "main" org.postgresql.util.PSQLException: Cannot cast an instance of [Ljava.math.BigInteger; to type Types.ARRAY
at org.postgresql.jdbc.PgPreparedStatement.setObject(PgPreparedStatement.java:1059)
at default.Test.main(DefaultDomainContext.java:211)
Caused by: java.sql.SQLFeatureNotSupportedException
at org.postgresql.jdbc.PgPreparedStatement.setObjectArray(PgPreparedStatement.java:777)
at org.postgresql.jdbc.PgPreparedStatement.setObject(PgPreparedStatement.java:1056)
... 1 more
```
If I do the same (see repro below) with `BigDecimal`, it works as expected.
**Driver Version?**
42.7.5
**Java Version?**
21
**OS Version?**
Archlinux
**PostgreSQL Version?**
17
**To Reproduce**
```
public static void main(String[] args) throws Exception {
String url = "jdbc:postgresql://localhost:5432/postgres";
Properties props = new Properties();
props.setProperty("user", "postgres");
props.setProperty("password", "postgres");
try (Connection conn = DriverManager.getConnection(url, props)) {
try (PreparedStatement statement = conn.prepareStatement("select ? = ANY(?)")) {
statement.setObject(1, BigInteger.ONE);
statement.setObject(2, new BigInteger[]{BigInteger.ONE});
try (ResultSet rs = statement.executeQuery()) {
if (rs.next()) {
System.out.println("result: " + rs.getBoolean(1));
}
}
}
}
}
```
**Expected behaviour**
It would work :)
view thread (5+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] issue #3608: Support BigInteger[] in PgPreparedStatement#setObject(int, java.lang.Object)
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox