aboutsummaryrefslogtreecommitdiff
path: root/src/include/utils/jsonapi.h
diff options
context:
space:
mode:
authorAndrew Dunstan <andrew@dunslane.net>2018-01-16 19:07:13 -0500
committerAndrew Dunstan <andrew@dunslane.net>2018-01-16 19:07:13 -0500
commitcc4feded0a31d2b732d4ea68613115cb720e624e (patch)
treea3e1a713c0a16cfb0dfbe02e9bf718fd56319adf /src/include/utils/jsonapi.h
parentd91da5ecedc8f8965bd35de66b09feb79c26e5ca (diff)
downloadpostgresql-cc4feded0a31d2b732d4ea68613115cb720e624e.tar.gz
postgresql-cc4feded0a31d2b732d4ea68613115cb720e624e.zip
Centralize json and jsonb handling of datetime types
The creates a single function JsonEncodeDateTime which will format these data types in an efficient and consistent manner. This will be all the more important when we come to jsonpath so we don't have to implement yet more code doing the same thing in two more places. This also extends the code to handle time and timetz types which were not previously handled specially. This requires exposing the time2tm and timetz2tm functions. Patch from Nikita Glukhov
Diffstat (limited to 'src/include/utils/jsonapi.h')
-rw-r--r--src/include/utils/jsonapi.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/utils/jsonapi.h b/src/include/utils/jsonapi.h
index d6baea5368c..e39572e00f2 100644
--- a/src/include/utils/jsonapi.h
+++ b/src/include/utils/jsonapi.h
@@ -147,4 +147,6 @@ 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);
+extern char *JsonEncodeDateTime(char *buf, Datum value, Oid typid);
+
#endif /* JSONAPI_H */