On Mon, Aug 21, 2017 at 1:14 PM, Daniele Varrazzo
<daniele.varrazzo@gmail.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