Re: Change in datetime type casting - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Change in datetime type casting
Date
Msg-id CA+mi_8YXzvN6h8uQs4+1M1Evy7KoOfeZoU9QTjzUEy1nGd9TcQ@mail.gmail.com
Whole thread Raw
In response to Re: Change in datetime type casting  (Federico Di Gregorio <fog@dndg.it>)
Responses Re: Change in datetime type casting
Re: Change in datetime type casting
List psycopg
On Thu, Jun 28, 2012 at 7:30 AM, Federico Di Gregorio <fog@dndg.it> wrote:
> On 28/06/12 01:19, Adrian Klaver wrote:

>> Note the addition of the casts. This is causing problems when using the
>> hstore adapter as hstore expects a plain string. Is there a way to get
>> around this?
>
> The cast were introduced because PostgreSQL 9.x is much strictier about
> function signatures than the 8.x series. Sometimes functions taking
> parameters were not found because of the implicit text->other type cast.

Hstore is a mapping from strings to strings, not a generic dictionary
mapping. There's never been a promise to adapt generic python
dictionary (mapping hashable -> anything) into it. Even if you ram a
python date into a postgres hstore, reading it back you will get a
string.

You can write a custom adapter to map the datetimes to strings without
the cast and use them into hstore.

-- Daniele

psycopg by date:

Previous
From: Federico Di Gregorio
Date:
Subject: Re: Change in datetime type casting
Next
From: Federico Di Gregorio
Date:
Subject: Re: Change in datetime type casting