Re: Functions returning complex types.
От | Tom Lane |
---|---|
Тема | Re: Functions returning complex types. |
Дата | |
Msg-id | 14875.1075149255@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Functions returning complex types. ("Thomas Hallgren" <thhal@mailblocks.com>) |
Список | pgsql-hackers |
"Thomas Hallgren" <thhal@mailblocks.com> writes: > ... exactly the same TupleTableSlot* that is passed into my > printMyComplextType function. This is of course extremely bad since the > MemoryContext where it was allocated has gone out of scope (I guess, since > this is another call). I don't think so; unless you are hacking memory contexts internally to your function. Here's some empirical proof that the function call mechanism is not broken: regression=# create type mytype as (f1 int ,f2 int); CREATE TYPE regression=# create function obtaintype(int,int) returns mytype as regression-# 'select $1,$2' language sql; CREATE FUNCTION regression=# select * from obtaintype(1,2);f1 | f2 ----+---- 1 | 2 (1 row) regression=# create function usetype(mytype) returns int as regression-# 'select $1.f1 + $1.f2' language sql; CREATE FUNCTION regression=# select usetype(obtaintype(1,2));usetype --------- 3 (1 row) regards, tom lane
В списке pgsql-hackers по дате отправления: