WL#12535: Retrieve the stored timestamp as UTC datetime

Affects: Server-8.0   —   Status: Complete

This work will add a standard SQL construction that can be used for retrieving a TIMESTAMP value in UTC time, the way it is read from the handler.

The construction adds the AT TIME ZONE operator, but it may only be used in a very limited context. See Functional and Non-Functional Requirements for details.

Example when the session's time zone is CET:

mysql> CREATE TABLE t1 ( a TIMESTAMP );
mysql> INSERT INTO t1 VALUES ( CURRENT_TIMESTAMP );
mysql> SELECT a FROM t1;
+---------------------+
| a                   |
+---------------------+
| 2020-04-29 16:43:19 |
+---------------------+
mysql> SELECT cast( a AT TIME ZONE 'UTC' AS DATETIME ) FROM t1;
+------------------------------------------+
| cast( a AT TIME ZONE 'UTC' AS DATETIME ) |
+------------------------------------------+
| 2020-04-29 14:43:19                      |
+------------------------------------------+