Re: PATCH: Add hstore_to_json()

From: Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: Add hstore_to_json()
Date: 2010-01-03 04:19:55
Message-ID: e08cc0401001022019y12a4450fr88cc8cde769db828@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2010/1/3 Peter Eisentraut <peter_e(at)gmx(dot)net>:
> On fre, 2010-01-01 at 17:19 -0500, Andrew Dunstan wrote:
>> Mine for one :-). Quite apart from any other reason I would expect it to
>> make indexing parts of the JSON more tractable. Say we use it to store a
>> web session object, which is a natural enough use. I might well want to
>> find or modify sessions with certain characteristics. I'm sure I
>> wouldn't be the only possible usewr who would want something
>> substantially more of such a type than just being able to validate it.
>> We have XPath for XML. and a substantial accessor API for hstore, so why
>> would we want anything less for JSON?
>
> Well, because they are not the same.  XML is a tree structure (and the
> XPath-SQL integration is already pretty weird), hstore is a set of
> key/value pairs, JSON is, supposedly, an object, which doesn't map very
> well to SQL.
JSON is all of trees, object (key-value pairs), and arrays, which help
denormalization of tables. Moreover, I think it's complementary to SQL
because it doesn't map to SQL.

I don't think there are many operations that we need inside DB for
JSON but at least indexing by gin is a typical case which means we
need arbitrary "fetch" value operation from an object. And now that
there are many server-side javascript like Node.js
(http://nodejs.org/), storing, validating and direct output without
converting from any other type is quite demanded feature of RDBM from
web developer's view.

A question: Isn't there no possibility that we have our own
implementation to handle JSON (i.e. no use of external libraries)?

Regards,

--
Hitoshi Harada

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2010-01-03 04:31:32 Re: PATCH: Add hstore_to_json()
Previous Message Andrew Dunstan 2010-01-03 04:13:09 Re: Change to config.pl processing in the msvc build environment