Re: Why this does not work ??

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why this does not work ??
Дата
Msg-id 26744.1088910431@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why this does not work ??  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-novice
I wrote:
> The loop variable of a for/select loop has to be a record or rowtype
> variable.  So you should do something like

>     declare
>         r record;
>     begin
>         for r in select * from original order by num asc loop
>             insert into copia(num) values(r.num);

>> WARNING:  plpgsql: ERROR during compile of copiar near line 4
>> ERROR:  missing .. at end of SQL expression

> I agree that this error message is not very helpful :-(

FYI, I have just committed some fixes that will hopefully provide more
helpful error messages for erroneous FOR-loops.  Your example will
draw

ERROR:  loop variable of loop over rows must be a record or row variable

in PG 7.5.

            regards, tom lane

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

Предыдущее
От: Roberto Rezende de Assis
Дата:
Сообщение: Re: Why this does not work ?? (Now it has worked)
Следующее
От: Markus Bertheau
Дата:
Сообщение: Re: Why this does not work ??