Re:

Поиск
Список
Период
Сортировка
От Adrian Klaver
Тема Re:
Дата
Msg-id 200909261345.51501.aklaver@comcast.net
обсуждение исходный текст
Ответ на Re:  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-general
On Saturday 26 September 2009 1:10:20 pm Pavel Stehule wrote:
> Hello
>
> 2009/9/26 Adrian Klaver <aklaver@comcast.net>:
> > On Friday 25 September 2009 9:52:09 am Pavel Stehule wrote:
> >> Hello
> >>
> >> this isn't possible now. All what you want are limited by SELECT
> >> statement in PostgreSQL. Simply PL knows only  SELECT statement and
> >> structure of result have to be strongly static - because it is based
> >> on static execution plan - it is determined before query start.
> >>
> >> Statement CALL isn't implemented yet.
> >>
> >> Regards
> >> Pavel Stehule
> >
> > I may be misinterpreting the docs section below, but I beg to differ.
> >
> > http://www.postgresql.org/docs/8.4/interactive/plpgsql-statements.html#PL
> >PGSQL-STATEMENTS-EXECUTING-DYN
>
> the sql for EXECUTE statement should be dynamic, but the structure of
> result have to be stable.
>
> Pavel
>

RECORD type, RETURN RECORD ?

38.3.4. Record Types

name RECORD;

Record variables are similar to row-type variables, but they have no predefined
structure. They take on the actual row structure of the row they are assigned
during a SELECT or FOR command. The substructure of a record variable can
change each time it is assigned to. A consequence of this is that until a
record variable is first assigned to, it has no substructure, and any attempt
to access a field in it will draw a run-time error.

Note that RECORD is not a true data type, only a placeholder. One should also
realize that when a PL/pgSQL function is declared to return type record, this
is not quite the same concept as a record variable, even though such a function
might use a record variable to hold its result. In both cases the actual row
structure is unknown when the function is written, but for a function returning
record the actual structure is determined when the calling query is parsed,
whereas a record variable can change its row structure on-the-fly.


--
Adrian Klaver
aklaver@comcast.net

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

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: generic modelling of data models; enforcing constraints dynamically...
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Column names in rowsets returned from function