From cc4feded0a31d2b732d4ea68613115cb720e624e Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Tue, 16 Jan 2018 19:07:13 -0500 Subject: 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 --- src/include/utils/jsonapi.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/include/utils/jsonapi.h') 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 */ -- cgit v1.2.3