pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: garyjob@krake.io
To: pgsql-bugs@postgresql.org
Subject: BUG #9168: Invalid JSON output generated by SQL statement
Date: Mon, 10 Feb 2014 08:19:33 +0000
Message-ID: <20140210081933.2710.73542@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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



view thread (2+ messages)  latest in thread

Message-ID: <20140210081933.2710.73542@wrigleys.postgresql.org>
Permalink:  ../20140210081933.2710.73542@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20140210081933.2710.73542@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: garyjob@krake.io
  Subject: Re: BUG #9168: Invalid JSON output generated by SQL statement
  In-Reply-To: <20140210081933.2710.73542@wrigleys.postgresql.org>
  References: <20140210081933.2710.73542@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox