Re: jsonb and nested hstore

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Merlin Moncure <mmoncure(at)gmail(dot)com>, Josh Berkus <josh(at)agliodbs(dot)com>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Christophe Pettus <xof(at)thebuild(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: jsonb and nested hstore
Date: 2014-03-06 05:07:00
Message-ID: CAM3SWZSewg++hhk9f9H4trVeddvxeB5fmaJ1acEh9U-1w-7FHA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Mar 5, 2014 at 11:32 AM, Bruce Momjian <bruce(at)momjian(dot)us> wrote:
> So, now knowing that hstore2 is just hierarchical hstore using the same
> hstore type name, you are saying that we are keeping the
> non-hierarchical code in contrib, and the rest goes into core --- that
> makes sense, and from a code maintenance perspective, I like that the
> non-hierarchical hstore code is not going in core.

Yeah.

It's hard to justify having a user-facing hstore2 on the grounds of
backwards compatibility, and giving those stuck on hstore the benefit
of all of these new capabilities. That's because we *cannot* really
preserve compatibility, AFAICT. Many of the lines of the patch
submitted are due to changes in the output format of hstore, and the
need to update the hstore tests' expected results to reflect these
changes. For example:

*************** select slice(hstore 'aa=>1, b=>2, c=>3',
*** 759,779 ****
(1 row)

select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']);
! slice
! --------------------
! "b"=>"2", "c"=>"3"
(1 row)

select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['aa','b']);
! slice
! ---------------------
! "b"=>"2", "aa"=>"1"
(1 row)

select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']);
! slice
! -------------------------------
! "b"=>"2", "c"=>"3", "aa"=>"1"
(1 row)

select pg_column_size(slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']))
--- 777,797 ----
(1 row)

select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b']);
! slice
! ----------------
! "b"=>2, "c"=>3
(1 row)

select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['aa','b']);
! slice
! -----------------
! "b"=>2, "aa"=>1
(1 row)

select slice(hstore 'aa=>1, b=>2, c=>3', ARRAY['c','b','aa']);
! slice
! -------------------------
! "b"=>2, "c"=>3, "aa"=>1
(1 row)

I could believe that there was at least something to be said for a
user-visible hstore2 if the new capabilites were available without
breaking application code, but it seems that isn't the case. Anyone
who is going to have to deal with some of this kind of incompatibility
one way or the other might as well switch over to jsonb entirely. When
changing aspects of our output format like this, the impact on users
is more or less a step function (of the number of small changes).

--
Peter Geoghegan

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josh Berkus 2014-03-06 06:16:46 Re: jsonb and nested hstore
Previous Message Amit Kapila 2014-03-06 04:24:57 Re: pg_ctl status with nonexistent data directory