On 01/15/2013 02:47 PM, Merlin Moncure wrote:
> On Tue, Jan 15, 2013 at 1:04 PM, David Fetter <david(at)fetter(dot)org> wrote:
>> On Mon, Jan 14, 2013 at 07:52:56PM -0500, Andrew Dunstan wrote:
>>> On 01/14/2013 07:36 PM, Merlin Moncure wrote:
>>>> While testing this I noticed that integer based 'get' routines are
>>>> zero based -- was this intentional? Virtually all other aspects of
>>>> SQL are 1 based:
>>>> postgres=# select json_get('[1,2,3]', 1);
>>>> (1 row)
>>>> postgres=# select json_get('[1,2,3]', 0);
>>>> (1 row)
>>> Yes. it's intentional. SQL arrays might be 1-based by default, but
>>> arrays as zero-based. I suspect the Json-using community would not
>>> thank us for being overly SQL-centric on this - and I say that as
>>> someone who has always thought zero based arrays were a major design
>>> mistake, responsible for countless off-by-one errors.
>> Perhaps we could compromise by making arrays 0.5-based.
> Well, I'm not prepared to argue with Andrew in this one. It was
> surprising behavior to me, but that's sample size one.
I doubt I'm very representative either. People like David Wheeler, Taras
Mitran, Joe Van Dyk, and the Heroku guys would be better people to ask
than me. I'm quite prepared to change it if that's the consensus.
In response to
pgsql-hackers by date
|Next:||From: Tom Lane||Date: 2013-01-15 20:22:11|
|Subject: Re: erroneous restore into pg_catalog schema|
|Previous:||From: Tom Lane||Date: 2013-01-15 20:11:02|
|Subject: Re: [PERFORM] Slow query: bitmap scan troubles|