Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0VVd-0002kb-EL for pgsql-jdbc@arkaria.postgresql.org; Mon, 05 Jul 2021 20:48:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m0VVa-000086-3w for pgsql-jdbc@arkaria.postgresql.org; Mon, 05 Jul 2021 20:48:02 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0VVZ-00007v-Ss for pgsql-jdbc@lists.postgresql.org; Mon, 05 Jul 2021 20:48:01 +0000 Received: from out-28.smtp.github.com ([192.30.252.211]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m0VVW-000754-JX for pgsql-jdbc@lists.postgresql.org; Mon, 05 Jul 2021 20:48:00 +0000 Received: from github.com (hubbernetes-node-053e085.ash1-iad.github.net [10.56.120.21]) by smtp.github.com (Postfix) with ESMTPA id 5CC57900A99 for ; Mon, 5 Jul 2021 13:47:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1625518076; bh=99nvFrI0kGvnxREyL3sf6darhuATPIh22JeFub6kERI=; h=Date:From:To:Subject:From; b=f+AVFbMAfSB55M1hBqjDuYwyRthkpAfagx7/yQLYTu7gi3Dm8I02ILiAsV7sQn456 QHeenjR+47f/LKTRnkoCQApQanHqScr3yRt436e9DAV+KO6EgmNDkUinfhvfL6DUNe tJx7h6tkr3+Hw72XN9QSI/5FwG1K6oyeZARMOulY= Date: Mon, 05 Jul 2021 13:47:56 -0700 From: Dave Cramer To: pgsql-jdbc@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] e1b843: backpatch #1949 (#2206) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Approved: 58GruLoMopuc X-GitHub-Recipient-Address: pgsql-jdbc@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/release/42.2 Home: https://github.com/pgjdbc/pgjdbc Commit: e1b8437848be9bdb13b63616fa9ee6788bfe3a34 https://github.com/pgjdbc/pgjdbc/commit/e1b8437848be9bdb13b63616fa9ee6788bfe3a34 Author: Dave Cramer Date: 2021-07-05 (Mon, 05 Jul 2021) Changed paths: M pgjdbc/src/main/java/org/postgresql/core/TypeInfo.java M pgjdbc/src/main/java/org/postgresql/jdbc/PgDatabaseMetaData.java M pgjdbc/src/main/java/org/postgresql/jdbc/TypeInfoCache.java M pgjdbc/src/test/java/org/postgresql/test/jdbc42/DatabaseMetaDataTest.java Log Message: ----------- backpatch #1949 (#2206) Fix: Rework sql type gathering to use OID instead of typname. This does not have the issue of name shadowing / qual-names, and has the added benefit of fixing #1948. Types that are not on the search path (e.g. they are shadowed, or in a schema that is not included in the search path) are stored in the caches as fully qualified type names and OIDs. As we cannot easily query the pg_type catalog using qualified type names, we replace the pgTypeName with the oid of the type name to query properties of the type. Testcases are added to improve coverage of correctly detecting SQL types that are not on the path, but are available through OID or qualified lookup. These types are stored internally as a fully qualified type, but we cannot use this name for lookup in pg_type. Special consideration has been given to Oid.UNSPECIFIED, as that needs to be mapped to Types.OTHER without first hitting the database. That mapping is static, but is not in `types` because it is not an actual type. Fixes #1948