Great ! On 04 Sep 2014, at 21:34, Esteban A. Maringolo <emaringolo@gmail.com> wrote:
Spurred by the last discussion about GLORP, Postgres and friends, I spent the last few hours looking into the workings of PostgresV2 to add support to the native JSON datatype provided by PostgreSQL 9.2.
According to PostgreSQL docs [1]: "The json data type can be used to store JSON (JavaScript Object Notation) data, as specified in RFC 4627. Such data can also be stored as text, but the json data type has the advantage of checking that each stored value is a valid JSON value. There are also related support functions available; see Section 9.15."
It is available at ConfigurationOfPostgresV2-EstebanMaringolo.12 in SmalltalkHub, blessed as #development (v2.4). It includes a testcase for the field converter (if the database server supports it).
JSON datatype allows the indexing and querying of data inside the structure of the json object.
Eg: SELECT jsonField->'attribute1'->'attribute2' FROM sampleTable;
Adding support of this to GLORP should be easy, but I have no time now :)
DISCLAIMER: I'm not using this in production, I tested it and seems to work as expected, and fail nosiliy when it should. This is why I blesed it as #development. If anybody is bold enough, bless it as #stable :)
Best regards,
Esteban A. Maringolo
[1] http://www.postgresql.org/docs/9.2/static/datatype-json.html