Re: latest hstore patch

From: "David E(dot) Wheeler" <david(at)kineticode(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: latest hstore patch
Date: 2009-09-24 00:16:07
Message-ID: 37C3BC90-5E3B-4618-9664-14EAB1DE4FE0@kineticode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 `(at)` 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 Content-Type Size
hstore-doc.patch application/octet-stream 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-09-24 00:25:13 Re: pg_hba.conf: samehost and samenet [REVIEW]
Previous Message Stef Walter 2009-09-23 23:56:47 Re: pg_hba.conf: samehost and samenet [REVIEW]