Question

Can You please guide us on how we can change the time zone of the Database to UTC which is migrated from AWS which was in time zone UTC? Now the Postgres 12 is installed in Ubuntu 20 which shows (show timezone; Asia/Kolkata ). We also want to make sure all the existing data inside the database should be changed to the new timezone. Because It is creating issues for the operation team to query on DB as all other DB in the env are in UTC.

Was it helpful?

Solution

You can change the parameter by editing postgresql.conf or with ALTER SYSTEM via SQL. Don't forget to reload the database.

But you should tell the application development team that they have messed up. If the application relies on a certain setting of timezone, then the application has to set that parameter itself. The parameter can be changed using the SET SQL statement.

If you don't care about time zone handling by PostgreSQL at all, you should use the data type timestamp without time zone.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top