Re: Hstore array implementation.

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Ronan Dunklau <rdunklau(at)gmail(dot)com>
Cc: psycopg(at)postgresql(dot)org
Subject: Re: Hstore array implementation.
Date: 2011-10-06 11:46:17
Message-ID: CA+mi_8Y18LDJ8+VsysAC1GZFB+ySdYtvvmrL8fPRcgWyD1Kvvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Thu, Oct 6, 2011 at 12:06 PM, Ronan Dunklau <rdunklau(at)gmail(dot)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 :)

In response to

Browse psycopg by date

  From Date Subject
Next Message Raoul Duke 2011-10-06 12:36:10 Re: psycopg and gevent with pgbouncer
Previous Message Ronan Dunklau 2011-10-06 11:06:08 Re: Hstore array implementation.