2012-01-31 17:48:23 +01:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
|
|
|
* json.h
|
|
|
|
* Declarations for JSON data type support.
|
|
|
|
*
|
2014-01-07 22:05:30 +01:00
|
|
|
* Portions Copyright (c) 1996-2014, PostgreSQL Global Development Group
|
2012-01-31 17:48:23 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
|
|
|
* src/include/utils/json.h
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef JSON_H
|
|
|
|
#define JSON_H
|
|
|
|
|
|
|
|
#include "fmgr.h"
|
2012-06-10 11:43:00 +02:00
|
|
|
#include "lib/stringinfo.h"
|
2012-01-31 17:48:23 +01:00
|
|
|
|
2013-03-29 19:12:13 +01:00
|
|
|
/* functions in json.c */
|
2012-01-31 17:48:23 +01:00
|
|
|
extern Datum json_in(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_out(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_recv(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_send(PG_FUNCTION_ARGS);
|
2012-02-03 18:11:16 +01:00
|
|
|
extern Datum array_to_json(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum array_to_json_pretty(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum row_to_json(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum row_to_json_pretty(PG_FUNCTION_ARGS);
|
2013-03-10 22:35:36 +01:00
|
|
|
extern Datum to_json(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
extern Datum json_agg_transfn(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_agg_finalfn(PG_FUNCTION_ARGS);
|
|
|
|
|
2014-01-28 23:48:21 +01:00
|
|
|
extern Datum json_object_agg_finalfn(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_object_agg_transfn(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
extern Datum json_build_object(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_build_object_noargs(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_build_array(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_build_array_noargs(PG_FUNCTION_ARGS);
|
|
|
|
|
|
|
|
extern Datum json_object(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_object_two_arg(PG_FUNCTION_ARGS);
|
|
|
|
|
2012-06-10 21:20:04 +02:00
|
|
|
extern void escape_json(StringInfo buf, const char *str);
|
2012-01-31 17:48:23 +01:00
|
|
|
|
2013-10-10 18:21:59 +02:00
|
|
|
extern Datum json_typeof(PG_FUNCTION_ARGS);
|
|
|
|
|
2013-03-29 19:12:13 +01:00
|
|
|
/* functions in jsonfuncs.c */
|
|
|
|
extern Datum json_object_field(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_object_field_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_array_element(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_array_element_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_extract_path(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_extract_path_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_object_keys(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_array_length(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_each(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_each_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_array_elements(PG_FUNCTION_ARGS);
|
2014-01-29 21:39:01 +01:00
|
|
|
extern Datum json_array_elements_text(PG_FUNCTION_ARGS);
|
2013-03-29 19:12:13 +01:00
|
|
|
extern Datum json_populate_record(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_populate_recordset(PG_FUNCTION_ARGS);
|
2014-01-28 23:48:21 +01:00
|
|
|
extern Datum json_to_record(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_to_recordset(PG_FUNCTION_ARGS);
|
2013-03-29 19:12:13 +01:00
|
|
|
|
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
2014-03-23 21:40:19 +01:00
|
|
|
extern Datum jsonb_object_field(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_object_field_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_array_element(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_array_element_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_extract_path(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_extract_path_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_object_keys(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_array_length(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_each(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_each_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_array_elements_text(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_array_elements(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_populate_record(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum jsonb_populate_recordset(PG_FUNCTION_ARGS);
|
|
|
|
|
2012-02-29 03:52:52 +01:00
|
|
|
#endif /* JSON_H */
|