Re: BUG #13884: array_to_json() works incorrectly for non-0-based arrays - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #13884: array_to_json() works incorrectly for non-0-based arrays
Date
Msg-id 13299.1453741077@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #13884: array_to_json() works incorrectly for non-0-based arrays  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: BUG #13884: array_to_json() works incorrectly for non-0-based arrays
List pgsql-bugs
Pavel Stehule <pavel.stehule@gmail.com> writes:
> 2016-01-24 11:47 GMT+01:00 <xtracoder@gmail.com>:
>> When postgres array has no elements at the beginning, array_to_json()
>> generates json array starting at the first initialized value

> It doesn't looks like bug - It hard to say, when is a start of PostgreSQL
> array and how PostgreSQL arrays should be serialized to JSON. First field
> in pg array is a first field in JSON array.

The current behavior looks reasonable to me too.  Certainly the proposed
change wouldn't be any more consistent --- what would happen when you had
elements with subscripts less than 1?

            regards, tom lane

pgsql-bugs by date:

Previous
From: Pavel Stehule
Date:
Subject: Re: BUG #13884: array_to_json() works incorrectly for non-0-based arrays
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #13884: array_to_json() works incorrectly for non-0-based arrays