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

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

    Try restarting the server. I updated Postgresql through Homebrew but forgot to restart the server and got this same problem. I believe it's due to the client and server versions not matching. psql started with:

    $ psql
    psql (9.1.4, server 9.1.2)
    Type "help" for help.
    
    0 讨论(0)
  • 2021-02-01 00:46

    Apparently, a similar thing also happens with Java/JDBC while connecting to Postgres.

    The solution there is to tell JDBC to report the correct user timezone to Postgres while getting the connection.

    So, explicitly mention the user timezone while starting the program helps:

    java -Duser.timezone=America/Los_Angeles com.example.MyMainClass
    

    Note:

    Adding this here because this happens to be the first result on Google for this issue with connecting to Postgres!

    Source:

    This comment by Yuriy on the Jira support forum: https://community.atlassian.com/t5/Jira-questions/invalid-value-for-parameter-quot-TimeZone-quot-quot-US-Pacific/qaq-p/839426

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

    Based on @MathiasJ's answer, instead of rebooting my entire machine, I ran

    brew services restart postgresql@9.6
    

    and my subsequent rake db:create worked perfectly.

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

    I also had this problem.

    Login to the database then issue:

    set time zone utc;
    
    0 讨论(0)
  • 2021-02-01 00:51

    Just a quick reference for those that are not using Postgres.app, but that start psql from the command line or through launchctl. You'll need to adjust the following for where you have your Postgres data and log files located at:

    pg_ctl stop
    pg_ctl start -D /usr/local/pgsql/data/ -l /usr/local/pgsql/log/server.log
    
    0 讨论(0)
  • 2021-02-01 00:53

    brew services restart postgresql

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