Re: stored procedure: RETURNS record

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: stored procedure: RETURNS record
Дата
Msg-id b42b73150909251727i3d9ed6b2j562133fe5bab1a0d@mail.gmail.com
обсуждение исходный текст
Ответ на Re: stored procedure: RETURNS record  (Rob Marjot <rob@marjot-multisoft.com>)
Ответы Re: stored procedure: RETURNS record  (InterRob <rob.marjot@gmail.com>)
Re: stored procedure: RETURNS record  (Rob Marjot <rob@marjot-multisoft.com>)
Список pgsql-general
On Fri, Sep 25, 2009 at 2:40 PM, Rob Marjot <rob@marjot-multisoft.com> wrote:
> Still no luck... To clarify a bit, take this example:
> CREATE OR REPLACE FUNCTION transpose()
>   RETURNS record AS
> $BODY$ DECLARE
>    output RECORD;
>  BEGIN
>    SELECT * INTO output FROM (VALUES(1,2)) as tbl(first,second);
>    RETURN output;
>  END;$BODY$
>   LANGUAGE 'plpgsql' STABLE
>   COST 100;
> Now, I expect to have 2 columns; named "first" and "second". However, like
> posted before, the flowing query:
> SELECT * FROM deserialize();
> produces only ONE column (in one row, as one would clearly expect from the
> function's defnition):
>  deserialize
> -----------
>  (1,2)
> (1 row)
>
> Any thoughts on how to make sure multiple columns are returned; without
> specifying this in the function's prototype return clause?

In a sense, what you are asking is impossible. Having a function (even
a C one) return 'record' does not get you out of having to define the
output columns...either in the function definition with 'out' or as
part of the calling query.  Depending on what you are trying to do,
this could either matter a little or a lot.  If it matters, why don't
you post some more details of the context of your problem and see if a
better solution can be found?

merlin

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

Предыдущее
От: Carlos Henrique Reimer
Дата:
Сообщение: Re: Low values for cached size
Следующее
От: Devrim GÜNDÜZ
Дата:
Сообщение: Re: Can't find SRPMs for PG 8.1.18 on RHEL4