Re: Proposal: plpgsql - "for in array" statement

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: Proposal: plpgsql - "for in array" statement
Дата
Msg-id AANLkTi=5oFX4qONrXRv2_--cTNE=T22mR+CgNem2V_DR@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Proposal: plpgsql - "for in array" statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Proposal: plpgsql - "for in array" statement  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
2010/9/28 Tom Lane <tgl@sss.pgh.pa.us>:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
>>>>> FOR var IN [array variable | array expression]
>>>>> LOOP
>
>> How about distinguishing it this way:?
>
>> FOR var IN ARRAY array_expression LOOP

I see one problem - when you can use a constant array, then you will
write two keywords ARRAY

FOR var IN ARRAY ARRAY[...] LOOP

iteration over cursor is supported now, and you don't write

FOR var IN CURSOR cursorvar

>
> That occurred to me too, but it's got a small problem: it's not
> impossible for ARRAY to be the first token of a valid scalar expression.
>

yes

> But I guess you could get around that if you had to by putting the ARRAY
> expression inside parens, and it would be a pretty darn unusual case
> anyway.  So this is probably the best choice.

I don't agree - There isn't reason for complicating proposed syntax.
The situation is relative simple and we are able to print a correct
messages.

regards

Pavel Stehule

I'm not thrilled with
> David's suggestions of using FOREACH or ITERATE --- using a different
> initial keyword makes it awkward to make generic statements about "all
> types of FOR loop".
>
>                        regards, tom lane
>


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

Предыдущее
От: Pavel Stehule
Дата:
Сообщение: Re: Proposal: plpgsql - "for in array" statement
Следующее
От: "Massa, Harald Armin"
Дата:
Сообщение: Re: documentation udpates to pgupgrade.html