Re: latest hstore patch - Mailing list pgsql-hackers

From David E. Wheeler
Subject Re: latest hstore patch
Date
Msg-id 37C3BC90-5E3B-4618-9664-14EAB1DE4FE0@kineticode.com
Whole thread Raw
In response to latest hstore patch  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: latest hstore patch
List pgsql-hackers
On Sep 22, 2009, at 7:18 PM, Andrew Gierth wrote:

> Hstore patch incorporating changes as previously discussed.
>
> In addition the requested new features of conversions to and from
> array formats have been added (with docs).

Thanks Andrew.

Just a few thoughts for discussion:

* From my previous posts: Is it time to kill off `@` and `~`,? Not
necessarily for your patch to handle, just wondering what others think.

* I like the %% operator for converting to arrays. Though I think
maybe I would have liked %@ better, but maybe that's just the Perl
hacker in me.

* I also like the new %# operator to convert to two-dimensional
arrays. But if you adopted %@ for arrays, maybe %@@ better indicates a
2-dimensional array? I'm just thinking out lout here, I'm happy to
have them no matter what they're called.

* More name stuff: Why `hstore_to_list` rather than `hstore_to_array`?
And I'm not sure about `hstore_to_matrix` for the 2-dimensional array.
I guess that's better than `hstore_to_multidimensional_array` would
be. ;-)

   For those following along at home, here's what these guys look like:

       SELECT %% 'a=>foo, b=>bar'::hstore as array_op,
              hstore_to_list('a=>foo, b=>bar'::hstore),
              %#  'a=>foo, b=>bar'::hstore as matrix_op,
              hstore_to_matrix('a=>foo, b=>bar'::hstore);
          array_op    | hstore_to_list |     matrix_op     |
hstore_to_matrix
       ---------------+----------------+-------------------
+-------------------
        {a,foo,b,bar} | {a,foo,b,bar}  | {{a,foo},{b,bar}} | {{a,foo},
{b,bar}}
       (1 row)

   Pretty cool!

* Thanks for updating the docs with:
   + BTREE and HASH index support
   + A fix for the populate_hash() pasto
   + A link to a discussion of backslashing and SQL standard strings
   + A note on the overhead of reading the old binary format
   + Notes on how to update from the old binary format

In the attached patch, I made a few tweaks to the hstore docs, after
applying your patch. I would have created a new patch with everything,
but ran out of time trying to convince Git to create a context diff.
This is a unified diff, but short, with just these changes:

* Fixed doc pasto for %#.
* Noted in docs that the format is new in 8.5, rather than "this
version".
* Eliminated a redundant "However, ".
* Added an example for creating a HASH index.

In sum: Modulo a discussion of the names of the array casting
operators and functions, I think this patch is ready for committer
review.

Thanks,

David


Attachment

pgsql-hackers by date:

Previous
From: Stef Walter
Date:
Subject: Re: pg_hba.conf: samehost and samenet [REVIEW]
Next
From: Tom Lane
Date:
Subject: Re: pg_hba.conf: samehost and samenet [REVIEW]