Or alternatively,
"timestamp without time zone default (now() at time zone 'utc')"
is fine as well and does make the time zone explicit in the type definition.
"timestamp without time zone default (now() at time zone 'utc')"
is fine as well and does make the time zone explicit in the type definition.
Let’s say I create a row at “12:34 5 April UTC”. If I now change client time zones and run a query, the epoch time will change to “12:34 5 April EST”. That’s probably not what you want.
The underlying issue is that most PG functions use timestamptz, and PG silently converts timestamp to timestamptz. This conversion uses the local TZ and can lead to nondeterministic behaviour from the perspective of the SQL expression.
Put another way, timestamptz is perfectly stable, timestamp can be nondeterministic, use timestamptz unless you are absolutely sure you know what you are doing.