Re: row_to_json bug with index only scans: empty keys! - Mailing list pgsql-hackers

From Ross Reedstrom
Subject Re: row_to_json bug with index only scans: empty keys!
Date
Msg-id 20141108211935.GA541@rice.edu
Whole thread Raw
In response to Re: row_to_json bug with index only scans: empty keys!  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: row_to_json bug with index only scans: empty keys!  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
I've no opinion on the not respecting aliases aspect of this, but both
the hstore and json emtpy keys case breaks the format: it's duplicate keys
that collapse to a single value, and expected keynames are missing.

The insidious bit about this bug though is that it works fine during testing
with the developers typically small data sets. It's only triggered in my case
when we the plan switches to index-only. Even an index scan works fine. I can't
imagine that there is code out there that _depends_ on this behavior. Just as
likely to me are that there exist systems that just have "can't reproduce" bugs
that would be fixed by this.

Ross


On Sat, Nov 08, 2014 at 01:09:23PM -0500, Tom Lane wrote:
> Oh, some more fun: a RowExpr that's labeled with a named composite type
> (rather than RECORD) has the same issue of not respecting aliases.
> Continuing previous example with table "foo":
> 
> regression=# create view vv as select * from foo;
> CREATE VIEW
> regression=# select row_to_json(q) from vv q;
>    row_to_json   
> -----------------
>  {"f1":1,"f2":2}
> (1 row)
> 
> regression=# select row_to_json(q) from vv q(a,b);
>    row_to_json   
> -----------------
>  {"f1":1,"f2":2}
> (1 row)
> 
> So that's another case we probably want to change in HEAD but not the back
> branches.
> 
>             regards, tom lane
> 

-- 
Ross Reedstrom, Ph.D.                                 reedstrm@rice.edu
Systems Engineer & Admin, Research Scientist        phone: 713-348-6166
Connexions                  http://cnx.org            fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E  F888 D3AE 810E 88F0 BEDE



pgsql-hackers by date:

Previous
From: Álvaro Hernández Tortosa
Date:
Subject: Re: Repeatable read and serializable transactions see data committed after tx start
Next
From: Andrew Dunstan
Date:
Subject: Re: row_to_json bug with index only scans: empty keys!