On Mar 6, 2014, at 1:51 AM, Peter Geoghegan <p...@heroku.com> wrote:

>> It's true for perl. Syntax of hstore is close to hash/array syntax and it's
>> easy serialize/deserialize hstore to/from perl. Syntax of hstore was
>> inspired by perl.
> I understand that. There is a module on CPAN called Pg::hstore that
> will do this; it appears to have been around since 2011. I don't use
> Perl, so I don't know a lot about it. Perhaps David Wheeler has an
> opinion on the value of Perl-like syntax, as a long time Perl
> enthusiast?

HSTORE was inspired by the syntax of Perl hash declarations, but it is not 
compatible. Notably, HSTORE the HSTORE can have a value `NULL`, while in Perl 
hashes it’s `undef`. So you cannot simply `eval` an HSTORE to get a Perl hash 
unless you are certain there are no NULLs.

Besides, string eval in Perl is considered unsafe. Parsing is *much* safer.

> In any case, Perl has excellent support for JSON, just like every
> other language - you are at no particular advantage in Perl by having
> a format that happens to more closely resemble the format of Perl
> hashes and arrays. I really feel that we should concentrate our
> efforts on one standardized format here. It makes the effort to
> integrate your good work, in a way that makes it available to everyone
> so much easier.

I agree. I like HSTORE, but now that JSON is so standard (in fact, as of this 
week, a *real* standard! http://rfc7159.net/rfc7159), and its support is so 
much better than that of HSTORE, including in Perl, I believe that it should be 
priority over HSTORE. I’m happy if HSTORE has the same functionality as JSONB, 
but given the choice, all other things being equal, as a Perl hacker I will 
always choose JSONB.



Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:

Reply via email to