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

前端 未结 15 642
甜味超标
甜味超标 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:30

    I don't think I deserve any points for that but rebooting my Postgres.app (which is better than rebooting the whole system) solved it for me. The app doesn't show up on the Dock, you can find it on the navbar at the top of your window. Hope it helps anyway.

    0 讨论(0)
  • 2021-02-01 00:31

    just restarting the database helped. Homebrew updated my Postgres installation and I did not restart yet.

    0 讨论(0)
  • 2021-02-01 00:34

    If nothing else fixes and you happen to be using homebrew, chances are you have issues with current links.

    Assuming you have two Postgres versions installed, make sure you unlink and then link again. In my case, I needed the two versions working in order to run pg_upgrade. I have postgresql95 and postgresql so I did:

    $ brew unlink postgresql
    $ brew unlink postgresql95
    $ brew link postgresql95
    $ brew link --overwrite postgresql 
    

    That got me both working at same time. Hope it becomes helpful as it took me a good while to figure that out!

    0 讨论(0)
  • 2021-02-01 00:36

    Restarting postgresql works.

    To restart if you've installed it using homebrew, brew info postgresql will tell you to:

    launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
    
    0 讨论(0)
  • 2021-02-01 00:36

    In my case restarting the database didn't help. Updating tzdata (apt-get install tzdata) did the trick for me.

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题