pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Inoue, Hiroshi <inoue@tpf.co.jp>
To: Walter Couto <Walter.Couto@EMBARCADERO.COM>
To: David Johnston <david.g.johnston@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: Re: Re: Inconsistency between JDBC and ODBC drivers when dealing with TIMESTAMP WITH TIME ZONE
Date: Wed, 11 Jun 2014 12:38:16 +0900
Message-ID: <5397CF28.1020503@tpf.co.jp> (raw)
In-Reply-To: <7FA4F9E5512F214C801E596ECD8790E066A83019@ETNAMAIL01.embarcadero.com>
References: <7FA4F9E5512F214C801E596ECD8790E066A82A9A@ETNAMAIL01.embarcadero.com>
	<1402359526172-5806595.post@n5.nabble.com>
	<7FA4F9E5512F214C801E596ECD8790E066A82D32@ETNAMAIL01.embarcadero.com>
	<53967920.3090308@aklaver.com>
	<5396865D.7080506@tpf.co.jp>
	<CAKFQuwYy-B2CbfAD3rCOyf_DxOEQ0hJisnJSJuOft9yW=NgN6w@mail.gmail.com>
	<7FA4F9E5512F214C801E596ECD8790E066A83019@ETNAMAIL01.embarcadero.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

Hi Walter,

I would enable time zone related code and complete the coding.
When I make a patch, could you test it?

(2014/06/10 19:31), Walter Couto wrote:
> Yes, I have to workaround this issue in my application since the
> existing issue as the current drivers have this bug. And to avoid
> overhead caching the server time zone is the best option to avoid
> repeated calls (thought their is a risk of you being wrong as you can
> changes the session time zone via a statement which will make the cached
> value wrong if it was run before that.
>
> As apposed to showing my code to get a SQL_C_CHAR  I'll show you the
> ODBC code that is perplexing:
>
> In convert.c's copy_and_convert_field() line 946: This case statement
> block states that for PG_TYPE_ABSTIME, PG_TYPE_DATETIME,
> PG_TYPE_TIMESTAMP_NO_TMZONE and PG_TYPE_TIMESTAMP that the string given
> by the server is:
>
> 1) -Infinity
>
> 2) -Infinity
>
> 3) invalid
>
> 4) %4d-%2d-%2d %2d:%2d:%2d%31s %15s (YYYY-MM-dd
> hh:mm:ss[.ffffff][-/+zh[:zm] [BC]) (max 35 characters for year < 10000)
>
> What that code does for 1) - 3) is perfectly fine, you have to choose
> some timestamp value and those values are as good as anything else. 4)
> is dealt by the function timestamp2stime on line 224 of the
> convert_field.  The only bug I see in this code is how it handles the
> time zone parsing, it only handles +/-zh, but not the possible but rare
> +/-zh:zm format/ That bug is in the switch statement on line 245 of that
> file. The cases for '+', '-' and '.' all don't check for the existence
> of ":" in the string.

Thanks.
I was surprized that the time zone in old Japanese days was
	+09:18:59
.
In fact using psql I see the following results.

=# select cast('1887-12-31 23:59:59' as timestamp with time zone);
          timestamptz
------------------------------
  1887-12-31 23:59:59+09:18:59

=# select cast('1887-12-31 23:59:60' as timestamp with time zone);
       timestamptz
------------------------
  1888-01-01 00:00:00+09

So I would take the form -/+zh[:zm[:zs]] into account.

regards,
Hiroshi Inoue

  ­­


-- 
I am using the free version of SPAMfighter.
SPAMfighter has removed 10739 of my spam emails to date.
Get the free SPAMfighter here: http://www.spamfighter.com/len

Do you have a slow PC? Try a Free scan 
http://www.spamfighter.com/SLOW-PCfighter?cid=sigen



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



view thread (12+ messages)  latest in thread

Message-ID: <5397CF28.1020503@tpf.co.jp>
Permalink:  ../5397CF28.1020503@tpf.co.jp/
Also on:    postgresql.org/message-id/5397CF28.1020503@tpf.co.jp

 · 

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-odbc@postgresql.org
  Cc: inoue@tpf.co.jp, Walter.Couto@EMBARCADERO.COM, david.g.johnston@gmail.com, adrian.klaver@aklaver.com
  Subject: Re: Inconsistency between JDBC and ODBC drivers when dealing with TIMESTAMP WITH TIME ZONE
  In-Reply-To: <5397CF28.1020503@tpf.co.jp>
  References: <7FA4F9E5512F214C801E596ECD8790E066A82A9A@ETNAMAIL01.embarcadero.com> <1402359526172-5806595.post@n5.nabble.com> <7FA4F9E5512F214C801E596ECD8790E066A82D32@ETNAMAIL01.embarcadero.com> <53967920.3090308@aklaver.com> <5396865D.7080506@tpf.co.jp> <CAKFQuwYy-B2CbfAD3rCOyf_DxOEQ0hJisnJSJuOft9yW=NgN6w@mail.gmail.com> <7FA4F9E5512F214C801E596ECD8790E066A83019@ETNAMAIL01.embarcadero.com> <5397CF28.1020503@tpf.co.jp>

* 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