Re: FOR-IN-EXECUTE, why fail?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: FOR-IN-EXECUTE, why fail?
Дата
Msg-id 8713.1090211001@sss.pgh.pa.us
обсуждение исходный текст
Ответ на FOR-IN-EXECUTE, why fail?  (mmarencibia@yahoo.es (Marcos Medina))
Список pgsql-novice
mmarencibia@yahoo.es (Marcos Medina) writes:
> I wrote the following:
> CREATE OR REPLACE FUNCTION escritorio.seq_valor_actual( text)
>  DECLARE
> ...
>      actual integer;
>  BEGIN
> ...
>  FOR actual IN EXECUTE v_query LOOP

The loop variable has to be a record or row variable, not an integer.

FWIW, 7.5 will give a better error message for this common mistake.
In CVS tip I get

ERROR:  loop variable of loop over rows must be a record or row variable at or near "LOOP" at character 416
LINE 14:  FOR actual IN EXECUTE v_query LOOP
                                        ^

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SQL - Indexing for performance on uniquness check...
Следующее
От: Gaetano Mendola
Дата:
Сообщение: Re: FOR-IN-EXECUTE, why fail?