aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/jsonapi.h
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2014-03-23 16:40:19 -0400
committerAndrew Dunstan <andrew@dunslane.net>2014-03-23 16:40:19 -0400
commitd9134d0a355cfa447adc80db4505d5931084278a (patch)
treecefe155d0f0f71b9279444a86eab4b1b1facafdb /src/include/utils/jsonapi.h
parentb2b2491b06074e68fc7c96148cb0fdf0c8eb0469 (diff)
downloadpostgresql-d9134d0a355cfa447adc80db4505d5931084278a.tar.gz
postgresql-d9134d0a355cfa447adc80db4505d5931084278a.zip
Introduce jsonb, a structured format for storing json.
The new format accepts exactly the same data as the json type. However, it is stored in a format that does not require reparsing the orgiginal text in order to process it, making it much more suitable for indexing and other operations. Insignificant whitespace is discarded, and the order of object keys is not preserved. Neither are duplicate object keys kept - the later value for a given key is the only one stored. The new type has all the functions and operators that the json type has, with the exception of the json generation functions (to_json, json_agg etc.) and with identical semantics. In addition, there are operator classes for hash and btree indexing, and two classes for GIN indexing, that have no equivalent in the json type. This feature grew out of previous work by Oleg Bartunov and Teodor Sigaev, which was intended to provide similar facilities to a nested hstore type, but which in the end proved to have some significant compatibility issues. Authors: Oleg Bartunov, Teodor Sigaev, Peter Geoghegan and Andrew Dunstan. Review: Andres Freund
Diffstat (limited to 'src/include/utils/jsonapi.h')
-rw-r--r--src/include/utils/jsonapi.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/include/utils/jsonapi.h b/src/include/utils/jsonapi.h
index 32fb0f79e7e..7a4fbfe4545 100644
--- a/src/include/utils/jsonapi.h
+++ b/src/include/utils/jsonapi.h
@@ -100,11 +100,17 @@ typedef struct JsonSemAction
extern void pg_parse_json(JsonLexContext *lex, JsonSemAction *sem);
/*
- * constructor for JsonLexContext, with or without strval element.
+ * constructors for JsonLexContext, with or without strval element.
* If supplied, the strval element will contain a de-escaped version of
* the lexeme. However, doing this imposes a performance penalty, so
* it should be avoided if the de-escaped lexeme is not required.
+ *
+ * If you already have the json as a text* value, use the first of these
+ * functions, otherwise use makeJsonLexContextCstringLen().
*/
extern JsonLexContext *makeJsonLexContext(text *json, bool need_escapes);
+extern JsonLexContext *makeJsonLexContextCstringLen(char *json,
+ int len,
+ bool need_escapes);
#endif /* JSONAPI_H */