From: pm@netcetera.ch
To: pgsql-jdbc@lists.postgresql.org
Subject: Re: ResultSet.getObject(..., LocalTime.class) not working with Postgres timetz type
Date: Tue, 9 Apr 2019 13:20:10 +0200
Message-ID: <bd979527-35f6-c9cb-74c5-3334a407fedb@netcetera.com> (raw)
In-Reply-To: <716bbd9d-7708-f73b-7b49-641cc9e2790b@gmx.net>
References: <q89m8j$63i8$1@blaine.gmane.org>
<f42cc628-83c9-d009-707a-347126539b2d@lawinegevaar.nl>
<716bbd9d-7708-f73b-7b49-641cc9e2790b@gmx.net>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: pm@netcetera.ch
Subject: Re: ResultSet.getObject(..., LocalTime.class) not working with Postgres timetz type
In-Reply-To: <bd979527-35f6-c9cb-74c5-3334a407fedb@netcetera.com>
References: <q89m8j$63i8$1@blaine.gmane.org> <f42cc628-83c9-d009-707a-347126539b2d@lawinegevaar.nl> <716bbd9d-7708-f73b-7b49-641cc9e2790b@gmx.net> <bd979527-35f6-c9cb-74c5-3334a407fedb@netcetera.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox