Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from a REFCURSOR
От | Daniel Verite |
---|---|
Тема | Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from a REFCURSOR |
Дата | |
Msg-id | cd253128-6cd9-4992-802a-d9672239fcec@manitou-mail.org обсуждение исходный текст |
Ответ на | Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from aREFCURSOR (Dent John <denty@QQdd.eu>) |
Ответы |
Re: [WIP] UNNEST(REFCURSOR): allowing SELECT to consume data from aREFCURSOR
|
Список | pgsql-hackers |
Dent John wrote: > It’s crashing when it’s checking that the returned tuple matches the > declared return type in rsinfo->setDesc. Seems rsinfo->setDesc gets > overwritten. So I think I have a memory management problem. What is the expected result anyway? A single column with a "record" type? FWIW I notice that with plpgsql, this is not allowed to happen: CREATE FUNCTION cursor_unnest(x refcursor) returns setof record as $$ declare r record; begin loop fetch x into r; exit when not found; return next r; end loop; end $$ language plpgsql; begin; declare c cursor for select oid::int as i, relname::text as r from pg_class; select cursor_unnest('c'); ERROR: set-valued function called in context that cannot accept a set CONTEXT: PL/pgSQL function cursor_unnest(refcursor) line 8 at RETURN NEXT Best regards, -- Daniel Vérité PostgreSQL-powered mailer: http://www.manitou-mail.org Twitter: @DanielVerite
В списке pgsql-hackers по дате отправления: