Attached is a patch that adds a 'json' contrib module. Although we
may want a built-in JSON data type in the near future, making it a
module (for the time being) has a couple advantages:
* Installable on current and previous versions of PostgreSQL. The
json module supports PostgreSQL 8.4.0 and up.
* Easier to maintain. json.sql.in is easy to work on,
src/include/catalog/pg_proc.h is not.
Currently, there are no functions for converting to/from PostgreSQL
values or getting/setting sub-values (e.g. JSONPath). However, I did
adapt the json_stringify function written by Itagaki Takahiro in his
patch ( http://archives.postgresql.org/pgsql-hackers/2010-09/msg01200.php
JSON datums are stored internally as condensed JSON text. By
"condensed", I mean that whitespace is removed, and escapes are
converted to characters when it's possible and efficient to do so.
Although a binary internal format would be more size-efficient in
theory, condensed JSON text is pretty efficient, too. Internally, the
implementation does not construct any parse trees, which should
provide a major performance advantage.
Almost all of the code has been rewritten since my original patch (
Some will be happy to know that the new code doesn't have any gotos
pgsql-hackers by date
|Next:||From: Robert Haas||Date: 2011-03-28 17:48:26|
|Subject: Re: Another swing at JSON|
|Previous:||From: Simon Riggs||Date: 2011-03-28 17:13:16|
|Subject: Re: Additional options for Sync Replication|