Gavin Flower <gavinflo...@archidevsys.co.nz> wrote: > Starting arrays at zero makes the most sense, as then you can > calculate the displacement simply as (index) * (size of entry), > and not have subtract one from the index first. This would be my > preference.
The SQL standard explicitly specifies that arrays positions range from 1 to the cardinality of the array, with individual elements referenced by position. When implementing a language for which there is an international standard, my preference is to conform to the standard. I don't have a problem with extensions to the language, and a variable low bound is workable as an extension as long as the standard ways to create an array default to a low bound of 1. A bigger problem with our array implementation is that is is really a multidimensional matrix, rather than an array which can contain nested arrays. That is both non-standard and limiting. That said, I think it would be nice to have better support for arrays defined with a single dimension and a low bound of 1, as the standard requires. Functions which throw an error when passed a non-conforming parameter and can provide a simplified API as a result would probably get used by me. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers