mirror of
https://github.com/postgres/postgres.git
synced 2026-02-18 10:09:35 -05:00
This adds the following:
json_agg(anyrecord) -> json
to_json(any) -> json
hstore_to_json(hstore) -> json (also used as a cast)
hstore_to_json_loose(hstore) -> json
The last provides heuristic treatment of numbers and booleans.
Also, in json generation, if any non-builtin type has a cast to json,
that function is used instead of the type's output function.
Andrew Dunstan, reviewed by Steve Singer.
Catalog version bumped.
35 lines
1 KiB
C
35 lines
1 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* json.h
|
|
* Declarations for JSON data type support.
|
|
*
|
|
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/utils/json.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
|
|
#ifndef JSON_H
|
|
#define JSON_H
|
|
|
|
#include "fmgr.h"
|
|
#include "lib/stringinfo.h"
|
|
|
|
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);
|
|
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);
|
|
extern Datum to_json(PG_FUNCTION_ARGS);
|
|
|
|
extern Datum json_agg_transfn(PG_FUNCTION_ARGS);
|
|
extern Datum json_agg_finalfn(PG_FUNCTION_ARGS);
|
|
|
|
extern void escape_json(StringInfo buf, const char *str);
|
|
|
|
#endif /* JSON_H */
|