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

Поиск
Список
Период
Сортировка
От Jaime Casanova
Тема Re: PL/pgSQL 'i = i + 1' Syntax
Дата
Msg-id c2d9e70e0605161751t70bb3ccbxfc8362f217695e3b@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PL/pgSQL 'i = i + 1' Syntax  (David Wheeler <david@kineticode.com>)
Ответы Re: PL/pgSQL 'i = i + 1' Syntax  (David Wheeler <david@kineticode.com>)
Список pgsql-hackers
On 5/16/06, David Wheeler <david@kineticode.com> 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
Дата:
Сообщение: Re: Compression and on-disk sorting
Следующее
От: David Wheeler
Дата:
Сообщение: Re: PL/pgSQL 'i = i + 1' Syntax