Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZoCJC-0003UO-Og for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2015 15:25:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZoCJC-0003al-Am for pgsql-bugs@arkaria.postgresql.org; Mon, 19 Oct 2015 15:25:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZoCJB-0003ZD-Nf for pgsql-bugs@postgresql.org; Mon, 19 Oct 2015 15:25:09 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZoCJ5-0007GK-9K for pgsql-bugs@postgresql.org; Mon, 19 Oct 2015 15:25:09 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1ZoCJ3-0003eb-H9; Mon, 19 Oct 2015 11:25:01 -0400 Date: Mon, 19 Oct 2015 11:25:01 -0400 From: Bruce Momjian To: "David G. Johnston" Cc: stepanperlov@gmail.com, "pgsql-bugs@postgresql.org" Subject: Re: BUG #13687: bug in row_to_json function with '-infinity' timestamp Message-ID: <20151019152501.GE24392@momjian.us> References: <20151019130052.3019.36176@wrigleys.postgresql.org> <20151019151248.GC24392@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On Mon, Oct 19, 2015 at 11:22:58AM -0400, David G. Johnston wrote: > Well, the output I see is: > >         SELECT row_to_json(t) >         FROM (SELECT '-infinity'::timestamptz) t ; >                 row_to_json >         ---------------------------- >          {"timestamptz":"infinity"} > > I assume the user expects positive infinity. > > > ​The user is expecting negative infinity...which I agree with. Sorry, yeah, I meant negative infinity. > Release notes do indicate this incompatibility: > >>> > When converting values of type date, timestamp or timestamptz to JSON, render > the values in a format compliant with ISO 8601 (Andrew Dunstan) > > Previously such values were rendered according to the current DateStyle > setting; but many JSON processors require timestamps to be in ISO 8601 format. > If necessary, the previous behavior can be obtained by explicitly casting the > datetime value to text before passing it to the JSON conversion function. > ​>>>​ > > ​But since ISO 8601 doesn't define infinity our implementation of this behavior > is not externally constrained and probably shouldn't be changed. Well, if infinity is not defined, we can output whatever seems logical, and returning +infinity for -infinity seems illogical. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Roman grave inscription + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs