From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Jim Nasby <jim(at)nasby(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Disallow arrays with non-standard lower bounds |
Date: | 2014-01-10 21:44:01 |
Message-ID: | 52D069A1.4010005@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 01/10/2014 04:26 PM, Jim Nasby wrote:
> On 1/9/14, 10:58 PM, Tom Lane wrote:
>> Jim Nasby <jim(at)nasby(dot)net> writes:
>>> ISTM that allowing users to pick arbitrary lower array bounds was a
>>> huge mistake. I've never seen anyone make use of it, can't think of
>>> any legitimate use cases for it, and hate the stupendous amount of
>>> extra code needed to deal with it.
>>
>> You lack imagination, sir.
>
> Considering what you'd normally want to do in SQL, the only example I
> can think of is to not have the argument over 0 vs 1 based.
>
> Actually, I was thinking there might be some computational problems
> where changing lower bound would be nice, but then again, what other
> languages actually support this?
Ada, for one. In fact, in Ada the index doesn't need to be an integer,
just an enumerable type (e.g. an enum). You can iterate over
one-dimensional arrays by saying:
FOR i IN [REVERSE] my_array'range LOOP ...
cheers
andrew (who sadly hasn't used Ada in anger for about 20 years).
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2014-01-10 21:49:34 | Re: Standalone synchronous master |
Previous Message | Simon Riggs | 2014-01-10 21:40:13 | Re: Add CREATE support to event triggers |