1

PostgreSQL 9.2 introduced JSON datatype. We had a discussion about the new datatype with a colleague of mine, but could not really come up with proper use-cases for it.

Are we just too-old school to understand the geniosity of storing JSON in database?

1 Answer 1

1

It's useful for extracting nested sets of data without having to de-duplicate left join sets. Otherwise I don't see tons of use for it at the moment.

In terms of data extraction it doesn't do anything that can't already be done better by the SQL/XML support that's been built-in for ages. It's much less rich, with no xpath equivalent and none of the same tools for building values from elements.

The json support can't take the place of hstore either, because there are no operators to look up keys, no merge or append operations, etc.

I expect that the JSON support will become more useful in 9.3 and later releases. The priority for 9.2 was just to get the data type and basic output functions in place. If the right people are interested it's likely to slowly take over much of hstore's functionality and provide a viable alternative to SQL/XML down the track. I proposed some value-building functions that'd make it more useful but the changes were rejected; see the discussion thread and this later thread.

Here's a blog post related to your question. As you can see, it's clearly somewhat early days for JSON support.

Sign up to request clarification or add additional context in comments.

2 Comments

I use it to store content used by javascript front en applications.
See also this post by Bruce Momjian. Check out some of the links as well. momjian.us/main/blogs/pgblog/2012.html#October_2_2012

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.