pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Philippe Marschall <pm@netcetera.ch>
To: Mark Rotteveel <mark@lawinegevaar.nl>
To: pgsql-jdbc@lists.postgresql.org
Subject: Re: ResultSet.getObject(..., LocalTime.class) not working with Postgres timetz type
Date: Wed, 17 Apr 2019 14:35:30 +0200
Message-ID: <22d06176-b0f9-13b7-a2e5-8e5b40798d17@netcetera.com> (raw)
In-Reply-To: <4abc4f90-f704-203b-5da1-215eaf4cf252@lawinegevaar.nl>
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>
	<4abc4f90-f704-203b-5da1-215eaf4cf252@lawinegevaar.nl>

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





view thread (15+ messages)  latest in thread

Message-ID: <22d06176-b0f9-13b7-a2e5-8e5b40798d17@netcetera.com>
Permalink:  ../22d06176-b0f9-13b7-a2e5-8e5b40798d17@netcetera.com/
Also on:    postgresql.org/message-id/22d06176-b0f9-13b7-a2e5-8e5b40798d17@netcetera.com

 · 

reply

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, mark@lawinegevaar.nl
  Subject: Re: ResultSet.getObject(..., LocalTime.class) not working with Postgres timetz type
  In-Reply-To: <22d06176-b0f9-13b7-a2e5-8e5b40798d17@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> <4abc4f90-f704-203b-5da1-215eaf4cf252@lawinegevaar.nl> <22d06176-b0f9-13b7-a2e5-8e5b40798d17@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