From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | "Fennell, Felix W(dot)" <felnne(at)bas(dot)ac(dot)uk> |
Cc: | "psycopg(at)postgresql(dot)org" <psycopg(at)postgresql(dot)org> |
Subject: | Re: Using infinite values with DateTimeTZRange |
Date: | 2017-08-21 12:27:57 |
Message-ID: | CA+mi_8bkMQ_LRL-Q3oyX5qtZbu5LHDPi+50kbtcCnfi34-UM4g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On Mon, Aug 21, 2017 at 1:14 PM, Daniele Varrazzo
<daniele(dot)varrazzo(at)gmail(dot)com> wrote:
[...]
> else:
> return psycopg2.extensions.DateFromPy(self.wrapped).getquoted()
>
> psycopg2.extensions.register_adapter(datetime, InfDateTimeTZAdapter)
>
> Once the dt adapter is fixed, the range adapter will use it automatically:
>
> >>> print psycopg2.extensions.adapt(validity).getquoted()
> tstzrange('2017-08-21T12:59:11.486205+00:00'::date,
> 'infinity'::datetimetz, '[)')
Sorry, this is obviously a bug in handling the not infinity dates :)
The else should be:
return psycopg2.extensions.TimestampFromPy(self.wrapped).getquoted()
with which the range adapter will return an adapted value like:
tstzrange('2017-08-21T13:23:49.222454+00:00'::timestamptz,
'infinity'::datetimetz, '[)')
-- Daniele
From | Date | Subject | |
---|---|---|---|
Next Message | Aryeh Leib Taurog | 2017-08-22 12:43:00 | pgcopy 1.3.0 release announcement |
Previous Message | Daniele Varrazzo | 2017-08-21 12:14:22 | Re: Using infinite values with DateTimeTZRange |