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 1hDooi-0002TQ-LZ for pgsql-jdbc@arkaria.postgresql.org; Tue, 09 Apr 2019 11:21:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hDoni-0007vB-MI for pgsql-jdbc@arkaria.postgresql.org; Tue, 09 Apr 2019 11:20:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDoni-0007v4-2x for pgsql-jdbc@lists.postgresql.org; Tue, 09 Apr 2019 11:20:26 +0000 Received: from mail.netcetera.ch ([194.126.145.7] helo=mail.netcetera.com) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hDona-0000wi-GT for pgsql-jdbc@lists.postgresql.org; Tue, 09 Apr 2019 11:20:24 +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 x39BKEHg026261 for ; Tue, 9 Apr 2019 13:20:14 +0200 Received: from xguard (localhost [127.0.0.1]) by xguard.netcetera.com (Postfix) with ESMTP id B8EBE68049B for ; Tue, 9 Apr 2019 13:20:14 +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 EF71268049B for ; Tue, 9 Apr 2019 13:20:11 +0200 (CEST) Received: from Philippes-MacBook.local ([172.19.119.6]) by netcetera.com (8.14.7/8.14.1) with ESMTP id x39BKB5j020639 for ; Tue, 9 Apr 2019 13:20:11 +0200 Subject: Re: ResultSet.getObject(..., LocalTime.class) not working with Postgres timetz type To: pgsql-jdbc@lists.postgresql.org References: <716bbd9d-7708-f73b-7b49-641cc9e2790b@gmx.net> From: pm@netcetera.ch Message-ID: Date: Tue, 9 Apr 2019 13:20:10 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <716bbd9d-7708-f73b-7b49-641cc9e2790b@gmx.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,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 06.04.19 19:40, Thomas Kellerer wrote: > Mark Rotteveel schrieb am 06.04.2019 um 10:15: >>> Retrieving the value of a timetz column fails when using getObject(, >>> LocalTime.class) >>> >>> I am not sure if this is the same as: >>> https://github.com/pgjdbc/pgjdbc/issues/1048 >>> If it's not the same root cause, should I create an issue? >>> >>> Using "select localtime" instead, works just fine > >> For reference, the JDBC specification does not specify support >> java.time.LocalXXX types on WITH TIME ZONE types. >> >> Especially because it is rather ambiguous what local would mean: would >> it mean local in the default JVM time zone, local at the original zone >> or local at UTC? > > Makes sense. > > However, the column is reported as Types.TIME and not > Types.TIME_WITH_TIMEZONE, that's why I stumbled over it. > > 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. [1] https://www.postgresql.org/docs/current/datatype-datetime.html#DATATYPE-TIMEZONES [2] https://github.com/pgjdbc/pgjdbc/pull/695 Cheers Philippe