Re: row_to_json bug with index only scans: empty keys!

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ross Reedstrom <reedstrm(at)rice(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: row_to_json bug with index only scans: empty keys!
Date: 2014-11-08 15:08:12
Message-ID: 545E31DC.9020009@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 11/08/2014 09:26 AM, Robert Haas wrote:
> On Fri, Nov 7, 2014 at 11:27 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2014-11-08 15:42:15 Re: Add CREATE support to event triggers
Previous Message Robert Haas 2014-11-08 14:42:40 Re: tracking commit timestamps