Re: PL/pgSQL loops?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: PL/pgSQL loops?
Дата
Msg-id 15769.1007014116@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: PL/pgSQL loops?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Ответы Re: PL/pgSQL loops?  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
Stephan Szabo <sszabo@megazone23.bigpanda.com> writes:
> Something like the below seemed to make it work for me under
> 7.2b3:

Oh ... duh!  I've been bit by that before myself.  In the original,
since the FOR loops were using integer variables (not record or rowtype
variables as they should've), the plpgsql parser was expecting an
integer FOR-loop.  Which goes like
FOR ivar IN expression .. expression LOOP stmts END LOOP;

Evidently, somewhere around the END LOOP it realized that it was missing
the .. part of the construct.

I've mumbled before that it's bad form to be using the declared type
of the FOR variable to drive the syntaxing of FOR loops --- poor error
recovery and unhelpful error messages are exactly the reasons why.
Not sure that this can easily be fixed, however.
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Return Opaque / Error in Function
Следующее
От: Markus Bertheau
Дата:
Сообщение: date_part vs extract