Re: Hstore array implementation. - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Hstore array implementation.
Date
Msg-id CA+mi_8Y18LDJ8+VsysAC1GZFB+ySdYtvvmrL8fPRcgWyD1Kvvw@mail.gmail.com
Whole thread Raw
In response to Re: Hstore array implementation.  (Ronan Dunklau <rdunklau@gmail.com>)
List psycopg
On Thu, Oct 6, 2011 at 12:06 PM, Ronan Dunklau <rdunklau@gmail.com> wrote:
> Sorry, I didn't see the bug report: last time I tried to access the bug
> tracker it was down.
> Don't be sorry, it did not take much time to implement, and I needed it
> right now.
> Generic array support is great !

Yes, it's neat, and it's the way all builtin array casters are
implemented. it's been buried in the C code since ever, it just had to
surface :)

> I've been waiting for it since a while (hstore arrays, record arrays...)
> Is your devel branch available publicly ?

It is in the devel branch of my clone, at
<https://github.com/dvarrazzo/psycopg/>, see commits of Sep 22.

> I tried to look at the devel branch from
>  git://luna.dndg.it/public/psycopg2.git, and did not find anything regarding
> that.
> Regarding new_type, does it automatically register an array type for every
> type, or does the developer have to manually register the type and array
> type ?

Registration has to be separate: for instance register_hstore() hast
something like that in its implementation:

    HSTORE = _ext.new_type(oid, "HSTORE", cast)
    _ext.register_type(HSTORE, [where])
    HSTOREARRAY = _ext.new_array_type(array_oid, "HSTOREARRAY", HSTORE)
    _ext.register_type(HSTOREARRAY, [where])

The hstore/composite casters think themselves to register the array
casters too; authors of new typecasters should do themselves in a
similar way.

> Thanks for the good work !

Cheers :)

psycopg by date:

Previous
From: Ronan Dunklau
Date:
Subject: Re: Hstore array implementation.
Next
From: Raoul Duke
Date:
Subject: Re: psycopg and gevent with pgbouncer