Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VE2il-00006b-Ff for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Aug 2013 19:45:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VE2ik-0005CV-QX for pgsql-bugs@arkaria.postgresql.org; Mon, 26 Aug 2013 19:45:02 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VE15q-00010h-8g for pgsql-bugs@postgresql.org; Mon, 26 Aug 2013 18:00:46 +0000 Received: from mahout.postgresql.org ([2001:4800:7903:4::123]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VE15n-0001Hb-B0 for pgsql-bugs@postgresql.org; Mon, 26 Aug 2013 18:00:45 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VE15m-0006f1-Uv for pgsql-bugs@postgresql.org; Mon, 26 Aug 2013 18:00:43 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.80) (envelope-from ) id 1VE15h-0006Zf-L8 for pgsql-bugs@postgresql.org; Mon, 26 Aug 2013 18:00:37 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: BUG #8398: to_json(''::hstore) gives invalid JSON To: pgsql-bugs@postgresql.org From: martin.kevin@gmail.com Message-Id: Date: Mon, 26 Aug 2013 18:00:37 +0000 X-Pg-Spam-Score: -0.7 (/) 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 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) The returned JSON will fail to be parsed by a conformant JSON parser. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs