Postgres error “invalid value for parameter ”TimeZone“: ”UTC“”

前端 未结 15 765
甜味超标
甜味超标 2021-02-01 00:26
Jupitor$ bundle exec rake db:create db:migrate
APP_development already exists
rake aborted!
PG::Error: ERROR:  invalid value for parameter \"TimeZone\": \"UTC\"
: SET ti         


        
15条回答
  •  余生分开走
    2021-02-01 00:36

    I had a similar problem after updating time zone information, that is, downloading the IANA database and compiling using zic.

    My problem actually began after restarting PostgreSQL. I got invalid value for parameter TimeZone: UTC and restarting again did nothing to solve the problem.

    It turns out my time zone information was completely messed up after the update. I had dangling symbolic links in /usr/share/zoneinfo. From a psql console, I got:

    mydb=# SELECT * FROM pg_timezone_names;
    ERROR:  could not stat "/usr/share/zoneinfo/PRC": No such file or directory
    

    I deleted all such dangling symlinks. After doing this, at least I could get SELECT * FROM pg_timezone_names to work, but still got the same invalid value... error.

    What finally solved the problem for me was creating a new symlink:

    cd /usr/share/zoneinfo
    ln -s Etc/UTC UTC
    

    After this, SET time zone 'UTC' worked correctly.

提交回复
热议问题