Centralize json and jsonb handling of datetime types
authorAndrew Dunstan <andrew@dunslane.net>
Wed, 17 Jan 2018 00:07:13 +0000 (19:07 -0500)
committerAndrew Dunstan <andrew@dunslane.net>
Wed, 17 Jan 2018 00:07:13 +0000 (19:07 -0500)
commitcc4feded0a31d2b732d4ea68613115cb720e624e
treea3e1a713c0a16cfb0dfbe02e9bf718fd56319adf
parentd91da5ecedc8f8965bd35de66b09feb79c26e5ca
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/backend/utils/adt/date.c
src/backend/utils/adt/json.c
src/backend/utils/adt/jsonb.c
src/include/utils/date.h
src/include/utils/jsonapi.h