Re: PL/pgSQL 'i = i + 1' Syntax

Поиск
Список
Период
Сортировка
Искать
От
Jaime Casanova
Тема
Re: PL/pgSQL 'i = i + 1' Syntax
Дата
в 21:51:22
Msg-id
c2d9e70e0605161751t70bb3ccbxfc8362f217695e3b@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Re: PL/pgSQL 'i = i + 1' Syntax "William ZHANG" <uniware@zedware.org>
On 5/16/06, David Wheeler  wrote:
> On May 16, 2006, at 16:30, Andrew Dunstan wrote:
>
> > It ought to be illegal to modify the loop control variable anyway,
> > IMNSHO - it certainly is in Ada, the distant antecedent of pl/pgsql.
>
> I agree, but I must say that it's incredibly useful to be able to
> increment by two as I go through a loop:
>
>      FOR i IN 1 + offset .. 11 + offset LOOP
>          total := total + substring(ean, i, 1)::INTEGER;
>          i = i + 1;
>      END LOOP;
>
> Best,
>
> David
>

i have posted a patch to add a BY clause to the for statement (integer
version), with the BY clause you can specify an increment value...

it's in the unapplied patches list waiting for review...

http://candle.pha.pa.us/mhonarc/patches/msg00003.html

-- 
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."                                      Richard Cook

В списке pgsql-hackers по дате отправления
От: Andrew Piskorski
Дата:
От: David Wheeler
Дата:
FAQ