summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Joey Adams [Sat, 26 Mar 2011 19:17:03 +0000 (15:17 -0400)]
Updated json.html
Joey Adams [Sat, 26 Mar 2011 18:37:20 +0000 (14:37 -0400)]
Remove json_send/json_recv and rename json_type/json_type_t to json_get_type/json_type
Joey Adams [Fri, 18 Mar 2011 15:53:16 +0000 (11:53 -0400)]
roadmap.markdown: Summarized Unicode handling, and made minor corrections.
Joey Adams [Fri, 18 Mar 2011 02:42:13 +0000 (22:42 -0400)]
roadmap.markdown: Set four primary goals, and improved unicode handling discussion.
Joey Adams [Fri, 21 Jan 2011 08:38:48 +0000 (03:38 -0500)]
Added roadmap.markdown
Joey Adams [Mon, 17 Jan 2011 20:43:57 +0000 (15:43 -0500)]
Added PostgreSQL 8.4.3 compatibility.
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).
Joey Adams [Mon, 17 Jan 2011 19:31:15 +0000 (14:31 -0500)]
Added json.html (documentation)
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.
Joey Adams [Mon, 17 Jan 2011 19:17:29 +0000 (14:17 -0500)]
Fixed UTF-16 surrogate pair calculation to properly handle cases like "\uD840\uDC00".
Joey Adams [Mon, 17 Jan 2011 19:13:35 +0000 (14:13 -0500)]
Removed FN_EXTRA macro and made getEnumLabelOids validate its entire input.
Joey Adams [Tue, 10 Aug 2010 05:10:19 +0000 (01:10 -0400)]
Added explicit NULL and '\0' checks, and documented more functions/structures.
Joey Adams [Fri, 6 Aug 2010 08:06:01 +0000 (04:06 -0400)]
Added more comments to json.c / json.h and cleaned it up a bit.
Also made json_delete a little less confusing (but it still uses gotos).
Joey Adams [Fri, 6 Aug 2010 06:23:12 +0000 (02:23 -0400)]
Finished refining and documenting code in util.c / util.h
Joey Adams [Fri, 6 Aug 2010 05:24:11 +0000 (01:24 -0400)]
Replaced enumLabelToOid with getEnumLabelOids and documented it.
enumLabelToOid merely looked up a single enum entry, while
getEnumLabelOids looks up all of them in bulk.
Joey Adams [Thu, 5 Aug 2010 22:33:38 +0000 (18:33 -0400)]
Simplified and documented getTypeInfo.
Also touched up documentation for FN_EXTRA a bit.
Joey Adams [Thu, 5 Aug 2010 20:58:10 +0000 (16:58 -0400)]
Made FN_EXTRA macro less magical and documented it better.
Joey Adams [Thu, 5 Aug 2010 04:17:51 +0000 (00:17 -0400)]
Lifted 0xFFFE/0xFFFF Unicode code point restriction.
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.
Joey Adams [Thu, 5 Aug 2010 03:53:30 +0000 (23:53 -0400)]
Renamed json_node to JSON in the C code.
Joey Adams [Thu, 5 Aug 2010 03:46:11 +0000 (23:46 -0400)]
Added license comments to source files and ran pgindent
Joey Adams [Thu, 5 Aug 2010 03:08:27 +0000 (23:08 -0400)]
Switched all error reporting from elog to ereport.
Joey Adams [Wed, 4 Aug 2010 21:44:22 +0000 (17:44 -0400)]
Made JSON datatype well-behaved with respect to character sets.
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.
Joey Adams [Sat, 24 Jul 2010 22:28:46 +0000 (18:28 -0400)]
* Migrated my Unicode functions to util.c and made them rely more on
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.
Joey Adams [Sat, 24 Jul 2010 01:41:04 +0000 (21:41 -0400)]
* Removed the string buffer code in json.c and used StringInfo instead.
* Removed json_cleanup and json_validate_liberal.
json_cleanup was badly in need of a rewrite.
Joey Adams [Sat, 24 Jul 2010 00:19:26 +0000 (20:19 -0400)]
* Migrated general-purpose functions to new files util.c/util.h
* A few various cleanups.
Joey Adams [Fri, 23 Jul 2010 22:01:36 +0000 (18:01 -0400)]
Ran pg_indent and made a few purely cosmetic changes (before running pg_indent again).
Joey Adams [Fri, 23 Jul 2010 21:13:59 +0000 (17:13 -0400)]
* JSONPath index subscript no longer extracts chars from strings.
* 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.
Joey Adams [Fri, 23 Jul 2010 19:35:20 +0000 (15:35 -0400)]
Replaced ginormous json_path testcase with a more trivial one.
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).
Joey Adams [Fri, 23 Jul 2010 02:59:59 +0000 (22:59 -0400)]
Updated documentation to cover new functions.
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).
Joey Adams [Thu, 22 Jul 2010 18:21:05 +0000 (14:21 -0400)]
Added support for arrays to to_json (but not from_json).
Joey Adams [Thu, 22 Jul 2010 16:00:15 +0000 (12:00 -0400)]
* Added json_set(json, json_path text, json) function.
* 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.
Joey Adams [Wed, 14 Jul 2010 04:45:34 +0000 (00:45 -0400)]
Changed json_get so it no longer automatically applies from_json.
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.
Joey Adams [Wed, 14 Jul 2010 04:37:27 +0000 (00:37 -0400)]
Oops, set json_get to return json before implementing it that way. Reverted.
Joey Adams [Wed, 14 Jul 2010 04:15:23 +0000 (00:15 -0400)]
Touched up capitalization a bit and named the "json_path" text parameter in functions that have one.
Joey Adams [Wed, 14 Jul 2010 04:05:24 +0000 (00:05 -0400)]
Refactored jsonpath a bit by introducing JPRef.
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.
Joey Adams [Tue, 6 Jul 2010 04:57:35 +0000 (00:57 -0400)]
Added DROP FUNCTION lines to uninstall_json.sql for json_validate and parse_json_path .
Joey Adams [Tue, 6 Jul 2010 04:51:48 +0000 (00:51 -0400)]
* Added json_get
* Affirmed (with a trivial test) that json_path returns its results breadth-first
Joey Adams [Mon, 21 Jun 2010 23:52:23 +0000 (19:52 -0400)]
* Made it so json_path preserves original text.
* Removed the global variable json_escape_unicode and added a parameter for it
to the json_encode and json_encode_string C functions.
Joey Adams [Thu, 17 Jun 2010 04:46:28 +0000 (00:46 -0400)]
* Added json_validate(text) function.
* 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.
Joey Adams [Tue, 15 Jun 2010 06:59:41 +0000 (02:59 -0400)]
Added json_condense function and split testcases into 3 files.
Joey Adams [Tue, 15 Jun 2010 02:49:13 +0000 (22:49 -0400)]
Initial implementation of json_path function.
Currently, it re-encodes JSON nodes rather than preserving original text.
This is subject to change.
Joey Adams [Mon, 14 Jun 2010 06:33:50 +0000 (02:33 -0400)]
Fixed expected/json.out (forgot to update it after adding last test).
Joey Adams [Mon, 14 Jun 2010 06:29:58 +0000 (02:29 -0400)]
Implemented/tested parser for basic JSONPath(ish) patterns.
Joey Adams [Sun, 13 Jun 2010 00:59:32 +0000 (20:59 -0400)]
Documented from_json, to_json, and json_type.
Added PGXS support to Makefile
Joey Adams [Wed, 9 Jun 2010 04:19:29 +0000 (00:19 -0400)]
Moved everything in /contrib/json along with json.sgml to root directory.
This repository should probably be an honest-to-goodness branch of
mainline PostgreSQL. I'm looking into that :-)
Joey Adams [Wed, 9 Jun 2010 03:23:34 +0000 (23:23 -0400)]
Implemented from_json (for basic types, just like to_json) along with testcases.
Joey Adams [Tue, 8 Jun 2010 02:53:34 +0000 (22:53 -0400)]
Implemented to_json along with testcases.
Joey Adams [Fri, 28 May 2010 03:22:34 +0000 (23:22 -0400)]
* Created new macro called PG_RETURN_ENUM to return an enum value given
its type name and value string.
Joey Adams [Fri, 28 May 2010 01:55:16 +0000 (21:55 -0400)]
* Added json_type function. The way it returns enum labels as Oids is
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 .
Joey Adams [Thu, 27 May 2010 06:18:40 +0000 (02:18 -0400)]
Initial commit. This provides a working JSON datatype with validity checking.
The code could use another pair of eyes.