This PR adds the types and framework to support TimeTZ, adding the
tree.Datum class to ensure it can be parsed and then also adds the
encoding for TimeTZ to be put in the database. This is the minimum
amount of work needed before any set of tests can pass - trying to keep
the PRs small but in the end did not succeed due to automated tests
iterating over all the types.
Changes per package (and recommended review order) are as follows:
**sql/types: added the new TimeTZ type and type family.**
**pkg/util/timetz: introduce new TimeTZ type**
Added a custom wrapper around timeofday and offset seconds, which form
follows postgres' implementation of `TimeTzADT`. Note that `OffsetSecs`
being negative / not what you expect is fully handled by all utility
functions from this interface.
**pkg/sql/sem/tree: add Datum for DTimeTZ**
A wrapper around TimeTZ for the tree expressions.
Also removed some magic constants I found whilst form following other
things.
**pkg/util/timeutil/pgdate: remove usage of testutil.IsError**
This causes a circular dependency on the new timetz type, and this was a
very straightforward way of going around it.
**pkg/util/encoding: added encoding for DTimeTZ**
Form following postgres, we store the timeofday and offset into the
database as 12 bytes - an 8 and 4 byte varint. To have sort order right,
and to form follow the btree encoding for TimeTZ, we use UTC time when
storing it for `(En|De)codeTimeTZ[As|Des]cending`.
**pkg/sql/pgwire: added pgwire for DTimeTZ**
**pkg/sql/sqlbase: added necessary changes to encode TimeTZ data**
**ccl/changefeedccl: added encoding for ccl**
Note we must use the string type here as we cannot encode two ints
nicely with avro, nor is one int enough to not lose data.
**sql/parser: added parsing support for TimeTZ**
I wanted to omit this in this PR but some of the automated tests
iterating over every time needs this. Note there are more bits to
implement which I will leave for a later PR.
**pkg/cli: add ability to dump TimeTZ**
**builtins: added equality support for TimeTZ**
**sql/logictest/testdata/logic_test: added basic tests for TimeTZ**
More to come, but here are some now since the parser is all hooked up.
As this is not the fully featured commit yet, I am omitting the release
note until the test suite is more fleshed out.
Release note: none