Skip to content

Commit

Permalink
Merge #42687
Browse files Browse the repository at this point in the history
42687: sql: complete eval functionality for TimeTZ r=otan a=otan

Refs: #26097

We want to support all operations that are supported by TimeTZ in
postgres:
* equality, less than
* timetz + date, interval + timetz
* timetz + interval, interval + timetz
* timetz - interval

```
otan=# select oprname, oprcode from pg_operator
where oprleft = 'timetz'::regtype or oprright = 'timetz'::regtype
     or oprresult = 'timetz'::regtype;
 oprname |      oprcode
---------+--------------------
 =       | timetz_eq
 <>      | timetz_ne
 <       | timetz_lt
 <=      | timetz_le
 >       | timetz_gt
 >=      | timetz_ge
 +       | datetimetz_pl
 +       | timetzdate_pl
 +       | timetz_pl_interval
 -       | timetz_mi_interval
 +       | interval_pl_timetz
(11 rows)
```

Release note: None

Co-authored-by: Oliver Tan <otan@cockroachlabs.com>
  • Loading branch information
craig[bot] and otan committed Dec 3, 2019
2 parents 1df2b2f + d062297 commit ed717cb
Show file tree
Hide file tree
Showing 14 changed files with 666 additions and 26 deletions.
13 changes: 13 additions & 0 deletions docs/generated/sql/operators.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<tr><td><a href="date.html">date</a> <code>+</code> <a href="int.html">int</a></td><td><a href="date.html">date</a></td></tr>
<tr><td><a href="date.html">date</a> <code>+</code> <a href="interval.html">interval</a></td><td><a href="timestamp.html">timestamp</a></td></tr>
<tr><td><a href="date.html">date</a> <code>+</code> <a href="time.html">time</a></td><td><a href="timestamp.html">timestamp</a></td></tr>
<tr><td><a href="date.html">date</a> <code>+</code> timetz</td><td><a href="timestamp.html">timestamptz</a></td></tr>
<tr><td><a href="decimal.html">decimal</a> <code>+</code> <a href="decimal.html">decimal</a></td><td><a href="decimal.html">decimal</a></td></tr>
<tr><td><a href="decimal.html">decimal</a> <code>+</code> <a href="int.html">int</a></td><td><a href="decimal.html">decimal</a></td></tr>
<tr><td><a href="float.html">float</a> <code>+</code> <a href="float.html">float</a></td><td><a href="float.html">float</a></td></tr>
Expand All @@ -70,10 +71,13 @@
<tr><td><a href="interval.html">interval</a> <code>+</code> <a href="time.html">time</a></td><td><a href="time.html">time</a></td></tr>
<tr><td><a href="interval.html">interval</a> <code>+</code> <a href="timestamp.html">timestamp</a></td><td><a href="timestamp.html">timestamp</a></td></tr>
<tr><td><a href="interval.html">interval</a> <code>+</code> <a href="timestamp.html">timestamptz</a></td><td><a href="timestamp.html">timestamptz</a></td></tr>
<tr><td><a href="interval.html">interval</a> <code>+</code> timetz</td><td>timetz</td></tr>
<tr><td><a href="time.html">time</a> <code>+</code> <a href="date.html">date</a></td><td><a href="timestamp.html">timestamp</a></td></tr>
<tr><td><a href="time.html">time</a> <code>+</code> <a href="interval.html">interval</a></td><td><a href="time.html">time</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code>+</code> <a href="interval.html">interval</a></td><td><a href="timestamp.html">timestamp</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code>+</code> <a href="interval.html">interval</a></td><td><a href="timestamp.html">timestamptz</a></td></tr>
<tr><td>timetz <code>+</code> <a href="date.html">date</a></td><td><a href="timestamp.html">timestamptz</a></td></tr>
<tr><td>timetz <code>+</code> <a href="interval.html">interval</a></td><td>timetz</td></tr>
</tbody></table>
<table><thead>
<tr><td><code>-</code></td><td>Return</td></tr>
Expand Down Expand Up @@ -105,6 +109,7 @@
<tr><td><a href="timestamp.html">timestamptz</a> <code>-</code> <a href="interval.html">interval</a></td><td><a href="timestamp.html">timestamptz</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code>-</code> <a href="timestamp.html">timestamp</a></td><td><a href="interval.html">interval</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code>-</code> <a href="timestamp.html">timestamptz</a></td><td><a href="interval.html">interval</a></td></tr>
<tr><td>timetz <code>-</code> <a href="interval.html">interval</a></td><td>timetz</td></tr>
</tbody></table>
<table><thead>
<tr><td><code>-></code></td><td>Return</td></tr>
Expand Down Expand Up @@ -161,12 +166,14 @@
<tr><td>oid <code><</code> oid</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="string.html">string</a> <code><</code> <a href="string.html">string</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code><</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code><</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code><</code> <a href="date.html">date</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code><</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code><</code> <a href="timestamp.html">timestamptz</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code><</code> <a href="date.html">date</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code><</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code><</code> <a href="timestamp.html">timestamptz</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code><</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code><</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td>tuple <code><</code> tuple</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="uuid.html">uuid</a> <code><</code> <a href="uuid.html">uuid</a></td><td><a href="bool.html">bool</a></td></tr>
Expand Down Expand Up @@ -202,12 +209,14 @@
<tr><td>oid <code><=</code> oid</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="string.html">string</a> <code><=</code> <a href="string.html">string</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code><=</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code><=</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code><=</code> <a href="date.html">date</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code><=</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code><=</code> <a href="timestamp.html">timestamptz</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code><=</code> <a href="date.html">date</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code><=</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code><=</code> <a href="timestamp.html">timestamptz</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code><=</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code><=</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td>tuple <code><=</code> tuple</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="uuid.html">uuid</a> <code><=</code> <a href="uuid.html">uuid</a></td><td><a href="bool.html">bool</a></td></tr>
Expand Down Expand Up @@ -252,6 +261,7 @@
<tr><td><a href="string.html">string</a> <code>=</code> <a href="string.html">string</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="string.html">string[]</a> <code>=</code> <a href="string.html">string[]</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code>=</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code>=</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time[]</a> <code>=</code> <a href="time.html">time[]</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code>=</code> <a href="date.html">date</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code>=</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
Expand All @@ -261,6 +271,7 @@
<tr><td><a href="timestamp.html">timestamptz</a> <code>=</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code>=</code> <a href="timestamp.html">timestamptz</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timestamptz <code>=</code> timestamptz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code>=</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code>=</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td>tuple <code>=</code> tuple</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="uuid.html">uuid</a> <code>=</code> <a href="uuid.html">uuid</a></td><td><a href="bool.html">bool</a></td></tr>
Expand Down Expand Up @@ -356,6 +367,7 @@
<tr><td><a href="string.html">string</a> <code>IS NOT DISTINCT FROM</code> <a href="string.html">string</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="string.html">string[]</a> <code>IS NOT DISTINCT FROM</code> <a href="string.html">string[]</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code>IS NOT DISTINCT FROM</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time</a> <code>IS NOT DISTINCT FROM</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="time.html">time[]</a> <code>IS NOT DISTINCT FROM</code> <a href="time.html">time[]</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code>IS NOT DISTINCT FROM</code> <a href="date.html">date</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamp</a> <code>IS NOT DISTINCT FROM</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
Expand All @@ -365,6 +377,7 @@
<tr><td><a href="timestamp.html">timestamptz</a> <code>IS NOT DISTINCT FROM</code> <a href="timestamp.html">timestamp</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td><a href="timestamp.html">timestamptz</a> <code>IS NOT DISTINCT FROM</code> <a href="timestamp.html">timestamptz</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timestamptz <code>IS NOT DISTINCT FROM</code> timestamptz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code>IS NOT DISTINCT FROM</code> <a href="time.html">time</a></td><td><a href="bool.html">bool</a></td></tr>
<tr><td>timetz <code>IS NOT DISTINCT FROM</code> timetz</td><td><a href="bool.html">bool</a></td></tr>
<tr><td>tuple <code>IS NOT DISTINCT FROM</code> tuple</td><td><a href="bool.html">bool</a></td></tr>
<tr><td>unknown <code>IS NOT DISTINCT FROM</code> unknown</td><td><a href="bool.html">bool</a></td></tr>
Expand Down
Loading

0 comments on commit ed717cb

Please sign in to comment.