Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGjn1-0005Lj-F4 for pgsql-jdbc@arkaria.postgresql.org; Wed, 17 Apr 2019 12:35:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hGjmy-0001X1-VS for pgsql-jdbc@arkaria.postgresql.org; Wed, 17 Apr 2019 12:35:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGjmy-0001WO-NS for pgsql-jdbc@lists.postgresql.org; Wed, 17 Apr 2019 12:35:44 +0000 Received: from mail.netcetera.ch ([194.126.145.7] helo=mail.netcetera.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hGjmr-00046s-Mz for pgsql-jdbc@lists.postgresql.org; Wed, 17 Apr 2019 12:35:43 +0000 Received: from xguard.netcetera.com (xguard.netcetera.com [192.168.8.150]) by mail.netcetera.com (8.14.7/8.14.1) with ESMTP id x3HCZaK7039406; Wed, 17 Apr 2019 14:35:36 +0200 Received: from xguard (localhost [127.0.0.1]) by xguard.netcetera.com (Postfix) with ESMTP id 0BBF8680526; Wed, 17 Apr 2019 14:35:36 +0200 (CEST) Authentication-Results: auth.opendkim.xorlab.com; dkim=none; dkim-atps=neutral Received: from netcetera.com (unknown [172.16.0.139]) by xguard.netcetera.com (Postfix) with ESMTPS id AC65D680526; Wed, 17 Apr 2019 14:35:33 +0200 (CEST) Received: from Philippes-MacBook.local ([172.19.119.6]) by netcetera.com (8.14.7/8.14.1) with ESMTP id x3HCZXEj057298; Wed, 17 Apr 2019 14:35:33 +0200 Subject: Re: ResultSet.getObject(..., LocalTime.class) not working with Postgres timetz type To: Mark Rotteveel , pgsql-jdbc@lists.postgresql.org References: <716bbd9d-7708-f73b-7b49-641cc9e2790b@gmx.net> <4abc4f90-f704-203b-5da1-215eaf4cf252@lawinegevaar.nl> From: Philippe Marschall Message-ID: <22d06176-b0f9-13b7-a2e5-8e5b40798d17@netcetera.com> Date: Wed, 17 Apr 2019 14:35:30 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.2 MIME-Version: 1.0 In-Reply-To: <4abc4f90-f704-203b-5da1-215eaf4cf252@lawinegevaar.nl> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,UNPARSEABLE_RELAY autolearn=disabled version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on sgaNetcetera List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10.04.19 14:43, Mark Rotteveel wrote: > On 9-4-2019 13:20, pm@netcetera.ch wrote: >> On 06.04.19 19:40, Thomas Kellerer wrote: >>> I think the driver should then support getObject(1, >>> OffsetTime.class), shouldn't it? >> >> It was originally not implemented out of laziness, somewhat justified >> by the fact that the documentation recommends against using the type >> saying it's only present because of legacy and standards compliance >> reasons.  From a functional point of view there is nothing wrong with >> implementing it. Again, in practice it's hard to find a use for the type. >> >> Yes the type should be Types.TIME_WITH_TIMEZONE. However in #695 [2] >> it was decided that following the JDBC specification would break >> frameworks and it would be better to instead go against the JDBC >> specification and instead having each framework implement driver >> specific hacks. > > This decision will still mean that frameworks will have to implement > driver-specific hacks though: That is those tools or frameworks that do > follow the guidance of the JDBC 4.2 or higher specification and expect > to be able to obtain the LocalXXX types here. > > If you declare that a column is Types.TIME(STAMP), then you should also > be able to return java.time.LocalTime, java.time.LocalDateTime (and of > course java.sql.Time/java.sql.Timestamp). > > Declaring Types.TIME(STAMP), but not supporting java.time.LocalXXX is in > my opinion a worse 'violation' of the JDBC specification compared to > declaring Types.TIME(STAMP) instead of Types.TIME(STAMP)_WITH_TIMEZONE. > By saying you are Types.TIMESTAMP, you implicitly promise to deliver the > type conversions defined in Appendix B of JDBC 4.3 (B.4/B.5). Supporting > java.time.OffsetDateTime / java.time.OffsetTime on Types.TIME(STAMP) is > then just a non-standard extension. > > That of course leaves the problem of ambiguity what local means in the > context of a type with time zone information. I agree with you. We should report _WITH_TIMEZONE as the type and support Offset* types for the tz database types. For the non tz types we support the Local* types and report Types accordingly. This is a case were deviating from the standard with well defined semantics just leads to more and more issues down the road. Cheers Philippe