Re: problem with timezone parsing

Karsten Hilbert <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Mon, Feb 16, 2009 at 10:36:34AM +0100, Federico Di Gregorio wrote:

> > > > PostgreSQL (on Debian/Lenny) comes with a bunch of time
> > > > zones which psycopg2 cannot parse, such as Asia/Calcutta.
> > > > Attempts to read a "timestamp with time zone" column with
> > > > client timezone set to one of those zones throw an "unable
> > > > to parse time" exception. Strangely enough, Asia/Colombo,
> > > > which has the same utc offset (05:30:00) parses just fine.
> > > >
> > > > The corresponding time zones can be found with the attached
> > > > script (make sure to adjust the DSN).
> > > >
> > > > That script also reports another category of time zones
> > > > which PostgreSQL includes but cannot use ;-)   But that's
> > > > beyond the scope of psycopg2.
> > > 
> > > By any chance are the problem dates fairly old?
> > 
> > If "1920" is "fairly old", then, yes.
> > 
> > Examples are the dates of birth of some people living
> > today. This is a patient database (www.gnumed.de).
> 
> I agree with you that we need a way to recover from such errors

Great !

> but I
> don't know if raising an exception is enough. If the error generates (or
> propagates) to PostgreSQL then the current transaction is aborted and
> this probably something you don't want.

"generated by PostgreSQL" - no, the problem arises in
psycopg2 code, PG itself is just fine with those time zones

"propagate to PostgreSQL" - well, if I *don't* handle the
exception then it seems quite OK to me if PostgreSQL
transactions are affected - should the exception somehow
propagate into PG (how ?)

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.