Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qeGy3-006KzZ-UT for pgsql-jdbc-commits@arkaria.postgresql.org; Thu, 07 Sep 2023 15:30:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qeGy1-002wzd-Sx for pgsql-jdbc-commits@arkaria.postgresql.org; Thu, 07 Sep 2023 15:30:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qeGy1-002wzP-Kj for pgsql-jdbc-commits@lists.postgresql.org; Thu, 07 Sep 2023 15:30:49 +0000 Received: from out-20.smtp.github.com ([192.30.252.203]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qeGxx-003hDw-AQ for pgsql-jdbc-commits@lists.postgresql.org; Thu, 07 Sep 2023 15:30:48 +0000 Received: from github.com (hubbernetes-node-2081ce3.va3-iad.github.net [10.48.201.51]) by smtp.github.com (Postfix) with ESMTPA id 5C6528C102C for ; Thu, 7 Sep 2023 08:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2023; t=1694100643; bh=hW8tFoRlaBJgqCF33WyqKlW5cVXMDjW2nh6UVwEm3ZU=; h=Date:From:To:Subject:From; b=CXcNYJG4/RevW+p6uxTi8ERaGPZN6hiaRB4YYDSxa5FMXM/3Fd9ho/8JNpGgVMBeF FOfl2GIdduXG0ICVJ7TGZ988H89SOgnNS11LIjvNcBqKXUSNhFxROSM0+iAJW0H8qv i1p91hrKugm0D+GezvWHzG32ZKO0NjD3xEM5gPVk= Date: Thu, 07 Sep 2023 08:30:43 -0700 From: Brendan MacDonell To: pgsql-jdbc-commits@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] 5709a2: fix: allow setting arrays with ANSI type name (#2952) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc-commits@lists.postgresql.org X-Auto-Response-Suppress: All List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: 5709a20fbef453749d2394e11502527e4a3ab5bb https://github.com/pgjdbc/pgjdbc/commit/5709a20fbef453749d2394e11502527e4a3ab5bb Author: Brendan MacDonell Date: 2023-09-07 (Thu, 07 Sep 2023) Changed paths: M pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java M pgjdbc/src/test/java/org/postgresql/test/jdbc2/ArrayTest.java Log Message: ----------- fix: allow setting arrays with ANSI type name (#2952) * fix: allow setting arrays with ANSI type name Currently, pgjdbc does not support setting arrays using ANSI type names like `double precision` or `timestamp with timezone`. For example, `conn.createArrayOf("double precision", new Object[] {0d})` fails with the exception "Unable to find server array type for provided name double precision". This can be worked around by using the PostgreSQL type name (e.g. `float8`) instead, however it seems like the driver should be able to handle the same set of array types as PostgreSQL itself. This isn't the first attempt to fix this issue. In 2020, #1719 was merged to fix the same problem. The patch caused some introspected types to change (#1744), and was reverted by #1745. Adding the missing types to `TYPE_ALIASES` fixes the problem, and avoids the OID collisions that caused #1744. * Wrap testSetArraysWithAnsiTypeNames in try-finally