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 1nZBPJ-0006Mw-UH for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Mar 2022 12:57:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZBOK-00024L-S8 for pgsql-jdbc@arkaria.postgresql.org; Tue, 29 Mar 2022 12:56:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZBLM-0007R7-EG for pgsql-jdbc@lists.postgresql.org; Tue, 29 Mar 2022 12:53:04 +0000 Received: from out-25.smtp.github.com ([192.30.252.208] helo=smtp.github.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZBLJ-00051l-VU for pgsql-jdbc@lists.postgresql.org; Tue, 29 Mar 2022 12:53:03 +0000 Received: from github.com (hubbernetes-node-b57f1fc.ash1-iad.github.net [10.56.226.43]) by smtp.github.com (Postfix) with ESMTPA id E117B840A58 for ; Tue, 29 Mar 2022 05:53:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1648558380; bh=JC3fMqQi8Rl26nnceQnU6Cc2MowC69HWQkqIYECjQDk=; h=Date:From:To:Subject:From; b=kd8ou+Kes8G/ihWTr7dQSdhSfhgJNC8qGhbrTBqln+ixs/qREA9IsK4Ydqw4ujcix JC9eRd43vjnTeqrm2iGXYVDHawpq78+IqTczv8CGzGLpMoh1qvvDyqxMNstJ8f2VDA bR4iusG68gCQquih4vn2qUcv9mt62IywF//Q18XA= Date: Tue, 29 Mar 2022 05:53:00 -0700 From: Uwe Schindler To: pgsql-jdbc@lists.postgresql.org Message-ID: Subject: [pgjdbc/pgjdbc] 3d14ea: feat: add support for ResultSet#getObject(OffsetTi... 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/master Home: https://github.com/pgjdbc/pgjdbc Commit: 3d14ea45688d98ebead548e00f78756841837434 https://github.com/pgjdbc/pgjdbc/commit/3d14ea45688d98ebead548e00f78756841837434 Author: Uwe Schindler Date: 2022-03-29 (Tue, 29 Mar 2022) Changed paths: M pgjdbc/src/main/java/org/postgresql/jdbc/PgPreparedStatement.java M pgjdbc/src/main/java/org/postgresql/jdbc/PgResultSet.java M pgjdbc/src/main/java/org/postgresql/jdbc/TimestampUtils.java M pgjdbc/src/test/java/org/postgresql/test/jdbc42/GetObject310Test.java M pgjdbc/src/test/java/org/postgresql/test/jdbc42/SetObject310Test.java M pgjdbc/src/test/java/org/postgresql/test/jdbc42/TimestampUtilsTest.java Log Message: ----------- feat: add support for ResultSet#getObject(OffsetTime.class) and PreparedStatement#setObject(OffsetTime.class) (#2467) * Add support for OffsetTime to Postgres JDBC; make parseBackendTimestamp() use a ZoneOffset instead of a Calendar instance * Revert the removal of the calendar cache (it is still needed for legacy conversion of Time/Date/Timestamp) * Add more tests and add support for OffsetTime in prepared statements * Add test for prepared statement * Correct implementation of cache * Change test to assert roundtrip on setObject(type) and getObject(type) return equal values (except the test with timestamp rounding) * Add TODO entry about missing constant * Update TimestampUtilsTest to have the special rounding conditions in the message * Rename parameter to what it originally was * Rewrite TimestampUtilsTest to use custom assertion method with good error messages * remove nullability suppression * add comments back * Disallow conversion of non-TZ to Offset and TZ types to Local time values: - refactor code to have the conversion exception at end of method as fallback - also check correct types in string mode" * Add missing checks to have all possible types * Remove type checks in getObject * Fix and move getLocalTime to the other JSR-310 methods, too * Add tests for invalid type conversions; cleanup test with try-with-resources