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