Incorrect daylight saving time on Postgresql

Asked

Viewed 5,576 times

2

With the change of date of the start of daylight saving time this year, postgresql database are experiencing problems (as well as several other systems), going on to inform the timezone with dls (Daylight saving) from day 21/10.

How to get SGDB to enter the time correctly ?

I use version 9.1, in updated versions the problem does not occur.

3 answers

3


This is because the bank’s Timezone files are outdated:

  1. Access the postgres, and download the latest version available (binaries only, no installer needed);

  2. Stop the service

  3. Copy the desired Timezone file (in my case, São Paulo):

    pgsql\share\timezone\America\Sao_Paulo

    to the equivalent directory at the bank facility.

  4. Start the service again.


Remember that Timezone must be set in postgres.conf as:

timezone='America/Sao_Paulo'

and, the database also:

alter database databasename set timezone to 'America/Sao_Paulo';

0

  1. Note if you work with systems of more than one time zone, I recommend setting in UTC.
  2. Note that you can set the time zone in ːTimezone="America/Sao_paulo" in postgresql.conf
  3. Copy the updated "Timezone" files from a newer version and replace them and restart the service.
  4. Postgresql when set the local time zone "localtime", on some operating systems will follow the time zone set at the operating system level which when updated brings daylight saving updates, use the command "show Timezone" on Postgres to check the time zone.

0

To get out of daylight saving time, GMT+3 To enter GMT+2

Follow commands below:

alter system set timezone="GMT+3";
select pg_reload_conf();
  • The problem with this approach is that every time summer time starts or ends, it will have to be changed again. Rovann’s answer above is better, because timezones like America/Sao_Paulo you already know if you have to use -2, -3 or any other value, and you already make the change automatically. Furthermore, in Brazilian daylight saving time, the correct is -3 and -2, not +3 and +2: https://www.timeanddate.com/time/zone/brazil/sao-paulo

Browser other questions tagged

You are not signed in. Login or sign up in order to post.