Message-ID: From: "victornoel (@victornoel)" To: "pgjdbc/pgjdbc" Date: Thu, 17 Apr 2025 15:50:10 +0000 Subject: [pgjdbc/pgjdbc] issue #3608: Support BigInteger[] in PgPreparedStatement#setObject(int, java.lang.Object) List-Id: X-GitHub-Author-Id: 160975 X-GitHub-Author-Login: victornoel X-GitHub-Issue: 3608 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: open X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3608 Content-Type: text/plain; charset=utf-8 **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 :)