Documentation Notes
Functions that take TIME or TIMESTAMP inputs come in two variants:
For brevity, these variants are not shown separately.
The + and * operators come in commutative pairs (for example both DATE + INTEGER and INTEGER + DATE); we show only one of each such pair.
Daylight Savings Time Considerations
When adding an INTERVAL value to (or subtracting an INTERVAL value from) a TIMESTAMP WITH TIME ZONE value, the days component advances (or decrements) the date of the TIMESTAMP WITH TIME ZONE by the indicated number of days. Across daylight saving time changes (with the session time zone set to a time zone that recognizes DST), this means INTERVAL '1 day' does not necessarily equal INTERVAL '24 hours'.
For example, with the session time zone set to CST7CDT:
TIMESTAMP WITH TIME ZONE '2005-04-02 12:00-07' + INTERVAL '1 day'
produces
TIMESTAMP WITH TIME ZONE '2005-04-03 12:00-06'
while adding INTERVAL '24 hours' to the same initial TIMESTAMP WITH TIME ZONE produces
TIMESTAMP WITH TIME ZONE '2005-04-03 13:00-06',
as there is a change in daylight saving time at 2005-04-03 02:00 in time zone CST7CDT.
Date/Time Functions in Transactions
CURRENT_TIMESTAMP
and related functions return the start time of the current transaction; their values do not change during the transaction. The intent is to allow a single transaction to have a consistent notion of the "current" time, so that multiple modifications within the same transaction bear the same time stamp. However, TIMEOFDAY()
returns the wall-clock time and advances during transactions.