Quixotic is a very good description, I’d happily admit that using the UTC domain in this way is not as pragmatic as I thought it would when I introduced it.
“Might not work the way you expect it to” is the underlying theme and the overall motivation for trying to master time zones from disparate sources.
As Peter and Francisco has previously demonstrated, I believe that inserting a timestamp into the UTC_TIMESTAMP column: (1) Checks the client time zone is UTC (2) Converts the timestamp to UTC, whether it was presented as UTC or not. Going to back to the original intention of enforcing UTC, the end result is correct, but for the wrong reason. In this example, row 3 contains the UTC value of '05/10/18 15:23+07’, which is the end result I wanted (pure UTC everywhere). But, the way that it is actually happens under the covers is masked by the use of the UTC_TIMESTAMP domain. In the scenario, there is a belief that only UTC timestamps are being inserted, which is not true. The way that Postgres stores any timestamp leads to the desired result, fooling me into believing that the UTC_TIMESTAMP domain is casual for the correct result. I would have need check whether the behavior is the same using a network client driver (maybe there is some implicit coercion going on when psql parses the statement). But I think the point still stands that Postgres timestamp handling is doing the real work and is casual for the desired outcome, not the domain. |