summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-03-26Updated json.htmlHEADmasterJoey Adams
2011-03-26Remove json_send/json_recv and rename json_type/json_type_t to ↵Joey Adams
json_get_type/json_type
2011-03-18roadmap.markdown: Summarized Unicode handling, and made minor corrections.Joey Adams
2011-03-18roadmap.markdown: Set four primary goals, and improved unicode handling ↵Joey Adams
discussion.
2011-01-21Added roadmap.markdownJoey Adams
2011-01-17Added PostgreSQL 8.4.3 compatibility.Joey Adams
The SearchSysCacheList1 macro was introduced in PostgreSQL 9. Changed a couple tests to cope with formatting discrepancy introduced by PostgreSQL 9 (namely, + characters between newlines).
2011-01-17Added json.html (documentation)Joey Adams
json.html is currently a hand-edited version of the file produced by running `make html` in the PostgreSQL source tree with json.sgml added to doc/src/sgml/ and a corresponding entry added to doc/src/sgml/filelist.sgml . Namely, I removed links and section numbers, and added "♫" by hand because openjade wasn't being cooperative with respect to unicode.
2011-01-17Fixed UTF-16 surrogate pair calculation to properly handle cases like ↵Joey Adams
"\uD840\uDC00".
2011-01-17Removed FN_EXTRA macro and made getEnumLabelOids validate its entire input.Joey Adams
2010-08-10Added explicit NULL and '\0' checks, and documented more functions/structures.Joey Adams
2010-08-06Added more comments to json.c / json.h and cleaned it up a bit.Joey Adams
Also made json_delete a little less confusing (but it still uses gotos).
2010-08-06Finished refining and documenting code in util.c / util.hJoey Adams
2010-08-06Replaced enumLabelToOid with getEnumLabelOids and documented it.Joey Adams
enumLabelToOid merely looked up a single enum entry, while getEnumLabelOids looks up all of them in bulk.
2010-08-05Simplified and documented getTypeInfo.Joey Adams
Also touched up documentation for FN_EXTRA a bit.
2010-08-05Made FN_EXTRA macro less magical and documented it better.Joey Adams
2010-08-05Lifted 0xFFFE/0xFFFF Unicode code point restriction.Joey Adams
Requiring decoded escapes to not be 0xFFFE or 0xFFFF is overzealous, I think. In any case, this isn't even a comprehensive list of the codepoints considered "invalid". Also, removed utf8_encode_char helper function, as it was extremely trivial and used in only one place.
2010-08-05Renamed json_node to JSON in the C code.Joey Adams
2010-08-05Added license comments to source files and ran pgindentJoey Adams
2010-08-05Switched all error reporting from elog to ereport.Joey Adams
2010-08-04Made JSON datatype well-behaved with respect to character sets.Joey Adams
Note that this is currently untested with server encodings other than UTF-8. The encoding policy used is: JSON nodes and most of the JSON functions still operate in UTF-8. Strings are converted between server encoding and UTF-8 when they go in and out of varlena (text*), and a set of helper functions are implemented to make these conversions simple to apply. It is done this way because converting individual codepoints to/from whatever the server encoding may be is nontrivial (possibly requires a loaded module). The JSON code needs to encode/decode codepoints when it deals with escapes. Although a more clever and efficient solution might be to defer charset conversions to when they're necessary (e.g. round up all the escapes and encode them all at once), this is not simple, and it's probably not much more efficient, either. Conversions to/from server encoding and UTF-8 are no-ops when the server encoding is UTF-8, anyway.
2010-07-24* Migrated my Unicode functions to util.c and made them rely more onJoey Adams
PostgreSQL's pg_wchar.h routines. * Touched up various functions' documentation. json_node's are currently encoded in UTF-8, and the JSON module is not 100% compatible with arbitrary server encodings yet. I plan to switch from UTF-8 to the server encoding pretty soon, after which JSON should be a well-behaved datatype as far as charsets go.
2010-07-24* Removed the string buffer code in json.c and used StringInfo instead.Joey Adams
* Removed json_cleanup and json_validate_liberal. json_cleanup was badly in need of a rewrite.
2010-07-24* Migrated general-purpose functions to new files util.c/util.hJoey Adams
* A few various cleanups.
2010-07-23Ran pg_indent and made a few purely cosmetic changes (before running ↵Joey Adams
pg_indent again).
2010-07-23* JSONPath index subscript no longer extracts chars from strings.Joey Adams
* char() method added to JSONPath for extracting chars from strings. Although index subscripts (those using an integer) extract characters from strings in Stefan Goessner's JSONPath, and although it works that way in JavaScript, I believe it is rather illogical and unexpected in the context of JSONPath, and a poor use of the [] real estate. Because extracting characters from strings can still be useful, I have added a char() method for this. I implemented it now to prevent the supporting code for character extraction from wasting away.
2010-07-23Replaced ginormous json_path testcase with a more trivial one.Joey Adams
The tests no longer take up 2.4 megabytes, and they'll be easier to update whenever semantics are changed (e.g. switching json_path '$..*' from matching breadth-first to depth-first).
2010-07-23Updated documentation to cover new functions.Joey Adams
I wrote an ad-hoc script in Haskell to generate SGML for the function table, and it is now in the repository (doc-to-sgml.hs) along with the corresponding input file (documentation).
2010-07-22Added support for arrays to to_json (but not from_json).Joey Adams
2010-07-22* Added json_set(json, json_path text, json) function.Joey Adams
* Reworked json_node::orig so it can handle replacing the key or value without altering surrounding formatting. * json_encode (C function) is now recursive (its stack usage depends on the depth of input). This was done because json_encode cannot rely on nodes' ->parent fields being trustworthy, as json_replace_value assigns JSON nodes by reference.
2010-07-14Changed json_get so it no longer automatically applies from_json.Joey Adams
Although automatic from_json may be convenient in some cases, it would require introducing an extra pair of functions (e.g. json_get_json and json_set_json) that work with JSON rather than converted JSON. Unless from_json(json_get(...)) turns out to be by far the most common usage pattern, I think knocking out the conversion wrapping here makes a lot more sense.
2010-07-14Oops, set json_get to return json before implementing it that way. Reverted.Joey Adams
2010-07-14Touched up capitalization a bit and named the "json_path" text parameter in ↵Joey Adams
functions that have one.
2010-07-14Refactored jsonpath a bit by introducing JPRef.Joey Adams
JPRef is a structure representing an item matched by jp_match. Before, plain old json_node was used, which couldn't distinguish between mutable references (actual JSON nodes from the original input) and immutable references (e.g. characters in a string). Yes, characters in a string are regarded as immutable because: * That's how it is in JavaScript. * It's easier to implement.
2010-07-06Added DROP FUNCTION lines to uninstall_json.sql for json_validate and ↵Joey Adams
parse_json_path .
2010-07-06* Added json_getJoey Adams
* Affirmed (with a trivial test) that json_path returns its results breadth-first
2010-06-21* Made it so json_path preserves original text.Joey Adams
* Removed the global variable json_escape_unicode and added a parameter for it to the json_encode and json_encode_string C functions.
2010-06-17* Added json_validate(text) function.Joey Adams
* Migrated test strings from json-0.0.2 * Added struct {...} orig; field to struct json_node, but it's not used yet. It will be used to hold pointers to original text.
2010-06-15Added json_condense function and split testcases into 3 files.Joey Adams
2010-06-15Initial implementation of json_path function.Joey Adams
Currently, it re-encodes JSON nodes rather than preserving original text. This is subject to change.
2010-06-14Fixed expected/json.out (forgot to update it after adding last test).Joey Adams
2010-06-14Implemented/tested parser for basic JSONPath(ish) patterns.Joey Adams
2010-06-13Documented from_json, to_json, and json_type.Joey Adams
Added PGXS support to Makefile
2010-06-09Moved everything in /contrib/json along with json.sgml to root directory.Joey Adams
This repository should probably be an honest-to-goodness branch of mainline PostgreSQL. I'm looking into that :-)
2010-06-09Implemented from_json (for basic types, just like to_json) along with testcases.Joey Adams
2010-06-08Implemented to_json along with testcases.Joey Adams
2010-05-28* Created new macro called PG_RETURN_ENUM to return an enum value givenJoey Adams
its type name and value string.
2010-05-28* Added json_type function. The way it returns enum labels as Oids isJoey Adams
rather ugly, but appears to work (and has been testcased). * Reordered json_type enum in json.h to match json_type_t in json.sql.in .
2010-05-27Initial commit. This provides a working JSON datatype with validity checking.Joey Adams
The code could use another pair of eyes.