BUG #5128: Returning nested composite types in plpython

Поиск
Список
Период
Сортировка
От
Тема BUG #5128: Returning nested composite types in plpython
Дата
Msg-id 200910201719.n9KHJwXN036846@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #5128: Returning nested composite types in plpython  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      5128
Logged by:
Email address:      landreville@deadtreepages.com
PostgreSQL version: 8.4
Operating system:   FreeBSD
Description:        Returning nested composite types in plpython
Details:

I have nested custom types and when I try to return a mapping in python the
nested type gives me a malform record error. Here is my test code and the
error:


create type type1 as (
    col1 text,
    col2 text
);

create type type2 as (
    col1 text,
    col2 text,
    test_type type1
);

create function returnComposite(test_one text, test_three text) RETURNS
type2 as
$$
    return {'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.

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

Предыдущее
От: "Jesse Morris"
Дата:
Сообщение: Re: Re: BUG #5065: pg_ctl start fails as administrator, with "could not locate matching postgres executable"
Следующее
От: takiguchi
Дата:
Сообщение: Re: BUG #5127: AbstractJdbc2Connection#doRollback should throws Exception if connection is closed