From: | Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com> |
---|---|
To: | psycopg(at)postgresql(dot)org |
Subject: | Re: Change in datetime type casting |
Date: | 2012-06-28 14:11:38 |
Message-ID: | 4FEC661A.8090102@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On 06/28/2012 02:21 AM, Daniele Varrazzo wrote:
> On Thu, Jun 28, 2012 at 7:30 AM, Federico Di Gregorio <fog(at)dndg(dot)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.
Which begs the question why does the adapter not do str(value) when
creating the ARRAY?
>
> You can write a custom adapter to map the datetimes to strings without
> the cast and use them into hstore.
Bigger question:) Is it possible to turn adaption off for a
connection/cursor?
>
> -- Daniele
>
--
Adrian Klaver
adrian(dot)klaver(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Daniele Varrazzo | 2012-06-28 14:43:18 | Re: Change in datetime type casting |
Previous Message | Federico Di Gregorio | 2012-06-28 09:31:43 | Re: Change in datetime type casting |