Re: flexi adaption/casting scheme

Поиск
Список
Период
Сортировка
От Tobias Oberstein
Тема Re: flexi adaption/casting scheme
Дата
Msg-id 505E0A13.6090605@gmail.com
обсуждение исходный текст
Ответ на Re: flexi adaption/casting scheme  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Список psycopg
Am 22.09.2012 20:42, schrieb Daniele Varrazzo:
> On Sat, Sep 22, 2012 at 7:02 PM, Tobias Oberstein
> <tobias.oberstein@gmail.com> wrote:
>>> Procedures with OUT parameters don't return a specific oid: they
>>> return a generic "record" oid (2249).
>>
>>
>> Sorry to bother you once more: is it possible to cast any PG RECORD
>> (anything OID 2249) into Python _lists_?
>
> Postgres doesn't tell you the oids of the components, so you cannot
> cast them to python types: you can only have them as strings.
>
> -- Daniele
>

Ok;( Thinking more about it, I now can see how the PG SQL "wire format"
just isn't self-describing, and that records are really anonymous
composite types.

Anyway, and FWIW, I've implemented a RecordCaster that does like you say
(parses RECORDs into Python lists of strings):

https://github.com/oberstet/scratchbox/blob/master/python/psycopg2/test9.py

Tokenizer code is stolen from your CompositeCaster;)

The stuff is of course of limited use .. all elements get cast to string.

The consequence is, that I probably need to require users of the
JSON-RPC to PG stored procedure stuff to have their (remoted) SPs
without OUT or INOUT parameters and without RECORD types. And probably
without VARIADIC also. Ok, having only 1 OUT works, but then one can use
RETURN just as well.

Thanks!

Tobias


В списке psycopg по дате отправления:

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Re: flexi adaption/casting scheme
Следующее
От: Daniele Varrazzo
Дата:
Сообщение: Range type adaptation implemented