Re: jsonb and nested hstore
От | David E. Wheeler |
---|---|
Тема | Re: jsonb and nested hstore |
Дата | |
Msg-id | EC333C99-61C0-4259-82BB-0B989EC9934D@justatheory.com обсуждение исходный текст |
Ответ на | Re: jsonb and nested hstore (Peter Geoghegan <pg@heroku.com>) |
Список | pgsql-hackers |
On Mar 6, 2014, at 1:51 AM, Peter Geoghegan <pg@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 havea value `NULL`, while in Perl hashes it’s `undef`. So you cannot simply `eval` an HSTORE to get a Perl hash unless youare 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 shouldbe priority over HSTORE. I’m happy if HSTORE has the same functionality as JSONB, but given the choice, all other thingsbeing equal, as a Perl hacker I will always choose JSONB. Best, David
В списке pgsql-hackers по дате отправления: