aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/jsonfuncs.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/utils/jsonfuncs.h')
-rw-r--r--src/include/utils/jsonfuncs.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/include/utils/jsonfuncs.h b/src/include/utils/jsonfuncs.h
index a85203d4a4b..121dfd5d248 100644
--- a/src/include/utils/jsonfuncs.h
+++ b/src/include/utils/jsonfuncs.h
@@ -63,4 +63,24 @@ extern Jsonb *transform_jsonb_string_values(Jsonb *jsonb, void *action_state,
extern text *transform_json_string_values(text *json, void *action_state,
JsonTransformStringValuesAction transform_action);
+/* Type categories returned by json_categorize_type */
+typedef enum
+{
+ JSONTYPE_NULL, /* null, so we didn't bother to identify */
+ JSONTYPE_BOOL, /* boolean (built-in types only) */
+ JSONTYPE_NUMERIC, /* numeric (ditto) */
+ JSONTYPE_DATE, /* we use special formatting for datetimes */
+ JSONTYPE_TIMESTAMP,
+ JSONTYPE_TIMESTAMPTZ,
+ JSONTYPE_JSON, /* JSON (and JSONB, if not is_jsonb) */
+ JSONTYPE_JSONB, /* JSONB (if is_jsonb) */
+ JSONTYPE_ARRAY, /* array */
+ JSONTYPE_COMPOSITE, /* composite */
+ JSONTYPE_CAST, /* something with an explicit cast to JSON */
+ JSONTYPE_OTHER, /* all else */
+} JsonTypeCategory;
+
+extern void json_categorize_type(Oid typoid, bool is_jsonb,
+ JsonTypeCategory *tcategory, Oid *outfuncoid);
+
#endif