Incorrect PostgreSQL Daylight Saving Time

2

With the change of daylight saving time start date this year, postgreSQL database is having problems (as well as several other systems), informing timezone with dls (daylight saving) from 21/10.

How do I get the SGDB to report the time correctly?

  

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

    
asked by anonymous 23.10.2018 / 23:54

2 answers

2

This happens because the Bank's Timezone files are outdated:

  • Access the postgres site , and download the latest available version (binaries only, do not need the installer);

  • Stop the service

  • Copy the desired timezone file (in my case, São Paulo):

    pgsql\share\timezone\America\Sao_Paulo

    to the equivalent directory in the bank installation.

  • Start the service again.

  • Remember that timezone must be defined in postgres.conf as:

    timezone='America/Sao_Paulo'
    

    and, the database too:

    alter database databasename set timezone to 'America/Sao_Paulo';
    
        
    23.10.2018 / 23:54
    0
  • Note if you work with systems with more than one time zone, I recommend configuring in UTC.
  • Note that you can set the time zone to 'timezone="America / Sao_Paulo" in postgresql.conf
  • Copy the updated / timezone files from a newer version and replace them and restart the service.
  • Postgresql when the localtime "localtime" time zone is set, some operating systems will follow the time zone set at the operating system level which when updated brings daylight saving updates, use the "show timezone" command in Postgres to check the time zone.
  • 28.10.2018 / 19:29