On Wed, Aug 25, 2010 at 1:34 AM, Itagaki Takahiro
<itagaki.takahiro@gmail.com> wrote:
> * Should we accept a scalar value as a valid JSON?
> According to RFC, the root element of JSON text must be an object
> or array. But to_json() and from_json() accept scalar values.
This seems a bit like the XML document/content distinction, which I've
never really understood. If [[1], false] is a legal JSON value, then
it seems odd that [1] should be legal but false not.
> * JSON to a scalar value by from_json()
> How about to have json_to_array(JSON) instead of from_json()?
> JSON value is always an array or object, it's nonsense to convert
> it to a scalar value directly; to an array seems to match better.
> In addition, an array can be indexed with GIN; index-able JSON
> type is very attractive.
Yeah, I don't like the excessive use of polymorphism either.
> * On-disk format of JSON values
> (There might be some discussions before... What is the conclusion?)
> The current code stores the original input text, but we can use
> some kinds of pre-parsed format to store JSON, like hstore.
> It can be different from BSON.
I see no value to choosing a different on-disk format. It might speed
up indexing, but I/O will be slower.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company