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

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: plpgsql - "for in array" statement
Date: 2010-09-28 22:04:15
Message-ID: 4CA2665F.1040000@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/28/2010 03:41 PM, Pavel Stehule wrote:

>
> It's not simple - FOR i IN array is natural - Original ADA use a very
> similar construct.

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:

for i in my_array'range loop ...

but that iterates over the array's index, not over its values.And there
is no ambiguity with other things you might loop over because there
aren't any.

cheers

andrew

[1]http://www.adaic.org/standards/05rm/html/RM-5-5.html

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergey Burladyan 2010-09-28 22:37:35 Re: UTF8 regexp and char classes still does not work
Previous Message Tom Lane 2010-09-28 22:00:52 Re: UTF8 regexp and char classes still does not work