Re: Proposal: plpgsql - "for in array" statement - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Proposal: plpgsql - "for in array" statement
Date
Msg-id 4CA2665F.1040000@dunslane.net
Whole thread Raw
In response to Re: Proposal: plpgsql - "for in array" statement  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
<br /><br /><br /> On 09/28/2010 03:41 PM, Pavel Stehule wrote:<br /><br /><blockquote
cite="mid:AANLkTi=18UivzKezbi+Eax0xx3LeHGr_CfK24z6xrMp1@mail.gmail.com"type="cite"><br /><pre wrap="">
 
It's not simple - FOR i IN array is natural - Original ADA use a very
similar construct. 
</pre></blockquote><br /><br /> No it doesn't. In Ada (Note: not ADA) FOR can only iterate over one thing: a discrete
subtype(e.g. an integer or enumeration type, or a range of it)[1]. You can say:<br /><blockquote>for i in
my_array'rangeloop ...<br /></blockquote> but that iterates over the array's index, not over its values.And there is no
ambiguitywith other things you might loop over because there aren't any.<br /><br /> cheers<br /><br /> andrew<br /><br
/>[1]<a class="moz-txt-link-freetext"
href="http://www.adaic.org/standards/05rm/html/RM-5-5.html">http://www.adaic.org/standards/05rm/html/RM-5-5.html</a><br
/>

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: UTF8 regexp and char classes still does not work
Next
From: Sergey Burladyan
Date:
Subject: Re: UTF8 regexp and char classes still does not work