In Postgresql how do I get localtime as the TimeZone to work on FreeBSD?



  • PostgreSQL: 9.4
    FreeBSD: 11.2

    When I set my TimeZone parameter in postgresql.conf to localtime I receive the following error when trying to start PostgreSQL.

    service postgresql restart
     LOG:  invalid value for parameter "TimeZone": "localtime"
     FATAL:  configuration file "/usr/local/pgsql/data/postgresql.conf" contains errors
    pg_ctl: could not start server
    Examine the log output.
    

    During my searches I've found https://www.postgresql.org/message-id/26280.1458583397%40sss.pgh.pa.us correspondence which seems to indicate that /etc/localtime should be a symlink. Mine isn't so I tried changing it to a symlink and it still didn't work as I get the same error as above.

    mv /etc/localtime /etc/localtime.bak
    ln -s /usr/share/zoneinfo/America/Yellowknife
    shutdown -r now
    ls -la /etc/localtime
    lrwxr-xr-x  1 root  wheel  35 Jun  2 11:04 /etc/localtime -> /usr/share/zoneinfo/America/Yellowknife
    

    Is it possible to get TimeZone set to localtime working on FreeBSD?

    Note that I also found https://serverfault.com/a/923556/961423 discussion where it mentions creating a symlink to /etc/localtime in /usr/share/zoneinfo. I tried that as well and it did not work as I still get the same error as above.

    Using pg_config --configure I see that it was not configured with --with-system-tzdata. Is this a requirement to using localtime?



  • The way you configured PostgreSQL, it does not use the operating system's time zone database, but its own copy, which is located in pg_config --sharedir. So your symbolic link has no effect.

    You'd have to create that symbolic link in PostgreSQL's copy of the timezone database, but the correct solution is different: set timezone to America/Yellowknife.

    Do not use unsupported PostgreSQL versions.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2