Re: BUG #5128: Returning nested composite types in plpython
От | Robert Haas |
---|---|
Тема | Re: BUG #5128: Returning nested composite types in plpython |
Дата | |
Msg-id | 603c8f070911090423y7b8df382u5a77c0fd95befcdb@mail.gmail.com обсуждение исходный текст |
Ответ на | BUG #5128: Returning nested composite types in plpython ("" <landreville@deadtreepages.com>) |
Список | pgsql-bugs |
On Tue, Oct 20, 2009 at 12:19 PM, <landreville@deadtreepages.com> wrote: > > The following bug has been logged online: > > Bug reference: =A0 =A0 =A05128 > Logged by: > Email address: =A0 =A0 =A0landreville@deadtreepages.com > PostgreSQL version: 8.4 > Operating system: =A0 FreeBSD > Description: =A0 =A0 =A0 =A0Returning nested composite types in plpython > Details: > > I have nested custom types and when I try to return a mapping in python t= he > nested type gives me a malform record error. Here is my test code and the > error: > > > create type type1 as ( > =A0 =A0 =A0 =A0col1 text, > =A0 =A0 =A0 =A0col2 text > ); > > create type type2 as ( > =A0 =A0 =A0 =A0col1 text, > =A0 =A0 =A0 =A0col2 text, > =A0 =A0 =A0 =A0test_type type1 > ); > > create function returnComposite(test_one text, test_three text) RETURNS > type2 as > $$ > =A0 =A0 =A0 =A0return {'col1': test_one, 'col2': test_one, 'test_type': {= 'col1': test_two, > 'col2': test_two}} > $$ language plpythonu; > > select returnComposite('test1','test2') > > ERROR: malformed record literal: "{'col2': 'test2', 'col1': 'test2'}" > SQL state: 22P02 > Detail: Missing left parenthesis. > > > If I put the nested type as ('test': test_two) it will return me the type > but it includes extra quotes. The only way to make this work is make a > select using plpy returning a type2 column. > > It would seem that the nested composite type is not being processed by > plpython and going straight to the rowtypes processing. See Peter's note here - apparently this is not supported. http://archives.postgresql.org/pgsql-bugs/2009-11/msg00073.php ...Robert
В списке pgsql-bugs по дате отправления: