pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #11210: Limit on Query causes error or no JSON labels in output
2+ messages / 2 participants
[nested] [flat]

* BUG #11210: Limit on Query causes error or no JSON labels in output
@ 2014-08-19 10:48 rqmedes@gmail.com
  2014-11-10 20:23 ` Re: BUG #11210: Limit on Query causes error or no JSON labels in output Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: rqmedes@gmail.com @ 2014-08-19 10:48 UTC (permalink / raw)
  To: pgsql-bugs

The following bug has been logged on the website:

Bug reference:      11210
Logged by:          darryl
Email address:      rqmedes@gmail.com
PostgreSQL version: 9.3.5
Operating system:   Windows
Description:        


--  Does not show  labels for json.  when a limit is used.
--  To replicate


CREATE SCHEMA test32 ; 
SET search_path = test32, pg_catalog, public; 

CREATE SEQUENCE _id INCREMENT 1 MINVALUE 1 MAXVALUE 9223372036854775807
START 1003480 CACHE 1; 

CREATE TABLE item ( 
      id integer NOT NULL DEFAULT nextval('test32._id'::regclass), 
      code text,
      name text NOT NULL, 
      ttype text 
) WITH ( OIDS=FALSE );

CREATE TABLE _inventory ( 
     id integer NOT NULL DEFAULT nextval('test32._id'::regclass), 
     name text NOT NULL, 
     ttype text DEFAULT 'inventory'::text 
) INHERITS (item) WITH ( OIDS=FALSE ); 

CREATE TABLE _service ( 
     id integer NOT NULL DEFAULT nextval('test32._id'::regclass), 
     name text NOT NULL, 
     ttype text DEFAULT 'service'::text 
) INHERITS (item) WITH ( OIDS=FALSE ); 

INSERT INTO _inventory (id, name) VALUES (1002376,'test32'); 
INSERT INTO _service (id, name) VALUES (1001498, 'Service1'); 


/*   Labels missing from json output when LIMIT IS added.
In version 9.3.5

-- FAILS  WHEN LIMIT IS ADDED --
Select row_to_json(_r) from ( select true as
success,array_agg(row_to_json(result)) as rows from (Select _0."id" as
"[id]" , _0."name" as "[name]" From "item" _0  Limit 10 OFFSET 0) result )
_r ;

OUTPUT =
{"success":true,"rows":[{"":1002376,"":"test32"},{"":1001498,"":"Service1"}]}
EXPECTED OUTPUT  = 
{"success":true,"rows":[{"[id]":1002376,"[name]":"test32"},{"[id]":1001498,"[name]":"Service1"}]}


-- WORKS WITH NO LIMIT
Select row_to_json(_r) from ( select true as
success,array_agg(row_to_json(result)) as rows from (Select _0."id" as
"[id]" , _0."name" as "[name]" From "item" _0 ) result ) _r ;
OUTPUT  = 
{"success":true,"rows":[{"[id]":1002376,"[name]":"test32"},{"[id]":1001498,"[name]":"Service1"}]}


In version 9.3.5 the limit causes the query to return json with blank
labels,

IN version 9.3.4  the limit causes the query to fail with an error of.
ERROR:  record type has not been registered
********** Error **********

ERROR: record type has not been registered
SQL state: 42809


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #11210: Limit on Query causes error or no JSON labels in output
  2014-08-19 10:48 BUG #11210: Limit on Query causes error or no JSON labels in output rqmedes@gmail.com
@ 2014-11-10 20:23 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2014-11-10 20:23 UTC (permalink / raw)
  To: rqmedes@gmail.com; +Cc: pgsql-bugs

rqmedes@gmail.com writes:
> --  Does not show  labels for json.  when a limit is used.

I've committed a fix for this, it will be in 9.3.6.  Thanks for the
report!

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2014-11-10 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-08-19 10:48 BUG #11210: Limit on Query causes error or no JSON labels in output rqmedes@gmail.com
2014-11-10 20:23 ` Tom Lane <tgl@sss.pgh.pa.us>

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