Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WCsRJ-0007f3-Iy for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Feb 2014 15:06:29 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WCsRJ-00038y-0b for pgsql-bugs@arkaria.postgresql.org; Mon, 10 Feb 2014 15:06:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WCm62-0003Ae-5h for pgsql-bugs@postgresql.org; Mon, 10 Feb 2014 08:20:06 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WCm5y-0002VC-UA for pgsql-bugs@postgresql.org; Mon, 10 Feb 2014 08:20:05 +0000 MIME-Version: 1.0 Subject: BUG #9168: Invalid JSON output generated by SQL statement To: pgsql-bugs@postgresql.org From: garyjob@krake.io Date: Mon, 10 Feb 2014 08:19:33 +0000 Message-ID: <20140210081933.2710.73542@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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: 9168 Logged by: Gary Teh Email address: garyjob@krake.io PostgreSQL version: 9.2.2 Operating system: MacOS X 10.7.5 Description: Statement to create the database table === CREATE TABLE test_tables ( properties hstore, "pingedAt" timestamp with time zone, id integer NOT NULL, "createdAt" timestamp with time zone NOT NULL, "updatedAt" timestamp with time zone NOT NULL ); Statement to create a record === INSERT INTO "test_tables" ("createdAt","updatedAt","pingedAt","properties") VALUES ('2014-2-10 0:10:28','2014-2-10 0:10:28','2014-2-10 0:10:28','"drug bank" => "cache \"that stuff"') Statement to export the record into a JSON file === Copy ( select array_to_json( array_agg( row_to_json(row) ) ) from ( SELECT properties::hstore->'drug bank' as "drug bank", "pingedAt" FROM "test_tables" WHERE true ) row ) To '/tmp/invalid_json_output' The invalid JSON output [{ "drug bank":"cache \\"that stuff", "pingedAt":"2014-02-09 16:10:28-08" },{ "drug bank":"cache \\"that stuff", "pingedAt":"2014-02-10 00:10:28-08" }] The final JSON output is not valid. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs