Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9NiS-0007iS-IY for pgsql-bugs@arkaria.postgresql.org; Fri, 31 Jan 2014 23:41:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1W9NiR-0002NO-IC for pgsql-bugs@arkaria.postgresql.org; Fri, 31 Jan 2014 23:41:43 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9NiQ-0002NI-SU for pgsql-bugs@postgresql.org; Fri, 31 Jan 2014 23:41:43 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1W9NiO-0000dM-K8 for pgsql-bugs@postgresql.org; Fri, 31 Jan 2014 23:41:42 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1W9NiN-0000fE-US; Fri, 31 Jan 2014 18:41:39 -0500 Date: Fri, 31 Jan 2014 18:41:39 -0500 From: Bruce Momjian To: martin.kevin@gmail.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #8398: to_json(''::hstore) gives invalid JSON Message-ID: <20140131234139.GE19957@momjian.us> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -2.5 (--) 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, Aug 26, 2013 at 06:00:37PM +0000, martin.kevin@gmail.com wrote: > The following bug has been logged on the website: > > Bug reference: 8398 > Logged by: Kevin Martin > Email address: martin.kevin@gmail.com > PostgreSQL version: 9.3rc1 > Operating system: Ubuntu 10.04 > Description: > > to_json() returns an invalid JSON value when called on an empty hstore > value. The first two statements below behave as expected, the third (with an > empty hstore) fails: > > > config_test=# SELECT to_json(q) FROM (SELECT '' AS v) AS q; > to_json > ---------- > {"v":""} > (1 row) > > > config_test=# SELECT to_json(q) FROM (SELECT ARRAY[]::INT[] AS v) AS q; > to_json > ---------- > {"v":[]} > (1 row) > > > config_test=# SELECT to_json(q) FROM (SELECT ''::HSTORE AS v) AS q; > to_json > --------- > {"v":} > (1 row) I see different/better(?) output in git head: SELECT to_json(q) FROM (SELECT ''::HSTORE AS v) AS q; to_json ---------- {"v":{}} (1 row) -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + Everyone has their own god. + -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs