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

From Andrew Dunstan
Subject Re: row_to_json bug with index only scans: empty keys!
Date
Msg-id 545E31DC.9020009@dunslane.net
Whole thread Raw
In response to Re: row_to_json bug with index only scans: empty keys!  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: row_to_json bug with index only scans: empty keys!  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 11/08/2014 09:26 AM, Robert Haas wrote:
> On Fri, Nov 7, 2014 at 11:27 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Thoughts?
> I'm not sure whether this is safe enough to back-patch, but it seems
> like we should probably plan to back-patch *something*, because the
> status quo isn't great either.
>


I confirm that Tom's patch does indeed fix my test case that produces 
empty field names.

We should probably not backpatch it, as it is a behaviour change. 
However, I do think we should add checks in composite_to_json and 
hstore_from_record for empty field names, and error out if they are 
found. That seems like an outright bug which we should defend against, 
including in the back branches. Giving back json or hstore objects with 
made up names like f1 is one thing, giving them back with empty names 
(which, in the hstore case will collapse everything to a single field) 
is far worse.

cheers

andrew



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: tracking commit timestamps
Next
From: Robert Haas
Date:
Subject: Re: Add CREATE support to event triggers