Similarly as in Convert Postgres TIMESTAMP to TIMESTAMPTZ, but with the difference that I don't plan to modify existing table's timestamp
columns. Are there any gotchas when using timestamptz
for new tables, when all the existing ones use timestamp
? Presuming that the existing clients will continue to use the DB as thus far (by always converting timestamps to UTC on their end), is there anything else one should consider?
1 Answer
timestamptz columns will be converted to the client's locale for display )and converted from it if no zone is specified on the input). so if you have several different users you will need be prepared for that.
If you existing clients are all configured to use UTC The only impact will be a '+00' at the end of the timestamptzs when they are returned as strings.
See also SQL ALTER DATABASE foo SET TIME ZONE 'UTC';
which can be used to set the default time zone for new connections from clients who don't explicitly set a time zone.
timestamp with time zone
everywhere in the database and have the application settimezone
correctly 2. usetimestamp without time zone
everywhere in the database and let the application do time zone conversions. So yes, usingtimestamp with time zone
may be a bad idea. I don't know enough about your application to say more.